CodingExcel Formula

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Mod_Inside (MODINSIDE)  
 To:  ALL
36931.1 

Hi,

 

Our Company has a load of Filling Stations they supply, and they wanted to use an auto roundup or down in a spreadsheet to change daily fluctuations in pricing to the sites.

 

ie if todays price was 98.25 it should round down to 98.00 if it was 98.67 it would round up to 98.90

 

Anyone any idea how to work that out? I've been reading about Round Max and Ceiling but they dont round after the decimal point or from what my limited knowledge in coding can fathom out.

 

Any ideas anyone?

 

Thanks

0/0
 Reply   Quote More 

 From:  99% of gargoyles look like (MR_BASTARD)  
 To:  Mod_Inside (MODINSIDE)     
36931.2 In reply to 36931.1 

You need to add 0 as the second argument:

 

ROUND(68.25,0)=68
ROUND(68.67,0)=69

bastard by name, bastard by nature

0/0
 Reply   Quote More 

 From:  Radio  
 To:  Mod_Inside (MODINSIDE)     
36931.3 In reply to 36931.1 

What he means is to add '1' as the second argument (i.e. the number of digits after the decimal point that you want to keep)

 

EDIT: Actually, your first post makes no sense. How can you round from 0.67 to 0.9???

My life is hard, I suffer lots
0/0
 Reply   Quote More 

 From:  99% of gargoyles look like (MR_BASTARD)  
 To:  Radio     
36931.4 In reply to 36931.3 
You're right, to round to 10p you'd use 1 to round to the nearest pound use 0, but the OP doesn't make sense. It was rounding down 25p to the nearest pound that threw me. :-$

bastard by name, bastard by nature

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Radio     
36931.5 In reply to 36931.3 
Because it's the price of petrol I assume. Most petrol prices are to the .9p

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Radio     
36931.6 In reply to 36931.3 
But actually, he's said 98.25 should go to 98.00, whereas if it was petrol prices it'd go to 97.9.

0/0
 Reply   Quote More 

 From:  JonCooper  
 To:  99% of gargoyles look like (MR_BASTARD)     
36931.7 In reply to 36931.4 
eh? he's not rounding down to the nearest pound, it's to the nearest penny

ie 98.25p rounded down to 98p

and equally 98.67p rounded up to 98.9p

that second one makes no sense to me, I assume it's some kind of marketing gimmick

Jon
0/0
 Reply   Quote More 

Message 36931.8 was deleted

 From:  Mod_Inside (MODINSIDE)  
 To:  ALL
36931.9 
Hi,

Our Company has a load of Filling Stations they supply, and they wanted to use an auto roundup or down in a spreadsheet to change daily fluctuations in pricing to the sites.

ie if todays price was 98.25 it should round down to 98.00 if it was 98.67 it would round up to 98.90

Anyone any idea how to work that out? I've been reading about Round Max and Ceiling but they dont round after the decimal point or from what my limited knowledge in coding can fathom out.

Any ideas anyone?

Thanks


Sorry I made an arse of it as I was in a hurry to go out somewhere else.

It should round up or down to the nearest 0.9

If its a low price like 98.25 it should round down to 97.90 or if its above 98.51 then should round up to 98.90

Apologies for the confusion.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Mod_Inside (MODINSIDE)     
36931.10 In reply to 36931.9 

So we're working with .9p.

 

Surely the middle value should be at .4p?

 

94.9<95.4<95.9

 

If <95.4 then it'll be 94.9
If ≥95.4 then it'll be 95.9


0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)  
 To:  ANT_THOMAS     
36931.11 In reply to 36931.10 

That looks about right.

 

Can I embarass myself and ask for a sample excel sheet ?!?

 

I cant obviously work with the values above but need sheet values to work it out in my head.

 

I know I know but im in no way a programmer and dont understand some of these functions!

 

Many thanks Ant

0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Mod_Inside (MODINSIDE)     
36931.12 In reply to 36931.11 

I'd help if I could, but I'm fairly shit with Excel.

 

I know what you want, but I don't exactly know how to implement it. But since we've cleared up what you're looking for then maybe someone else will be able guide you!


0/0
 Reply   Quote More 

 From:  Matt  
 To:  Mod_Inside (MODINSIDE)     
36931.13 In reply to 36931.9 

Unless I'm misunderstanding things:

 

=IF(MOD(x,FLOOR(x,1))>=0.51,FLOOR(x,1)+0.9,FLOOR(x,1)-0.1)

 

I'm no good at writing Excel macros, but you can put that directly in the cell you want to update and change x to the cell number, i.e. A1.

doohicky

0/0
 Reply   Quote More 

 From:  patch  
 To:  Matt     
36931.14 In reply to 36931.13 
Wouldn't it be easier to round to the nearest pound/penny/whatever, and then subtract 0.1? Or am I too tired to be thinking about this kind of thing?
0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)  
 To:  ALL
36931.15 

Thanks all, especially Ant and Matt. I'll give them a go tomorrow and see how I get on.

 

I'll let you know, thanks again though.

0/0
 Reply   Quote More 

 From:  Matt  
 To:  patch     
36931.16 In reply to 36931.14 
Yes, but no. Excel's round function rounds up on 0.50 and not 0.51 as Mod Inside wanted.

doohicky

0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)  
 To:  Matt     
36931.17 In reply to 36931.13 

Matt your a feckin genius!

 

It works perfect, thank you very much. I would honestly never in a million years worked that out, I've honestly been reading shitloads about Roundup/Ceilings/Floors/etc etc.

 

Didn't have a clue what to do next.

 

Thanks a lot, really appreciated.

 

PS. Attached a test Spreadsheet to show the calculation for the future, if anyone is needing it (unlikely I know)

Attachments:
Book1.xls

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Matt     
36931.18 In reply to 36931.16 
Given the reply to Ant's question, I would challenge MI to confirm if he specifically wants 0.5 rounding down or not.

Cus ROUND(x)-0.1 (or whatever) is far nicer than that big multi-storey thing.
0/0
 Reply   Quote More 

 From:  Matt  
 To:  Peter (BOUGHTONP)     
36931.19 In reply to 36931.18 
Agreed, it is against what we're taught, but these petrol people have funny rules about prices.

doohicky

0/0
 Reply   Quote More 

 From:  Radio  
 To:  Matt     
36931.20 In reply to 36931.19 
It made a bit of sense when petrol was 35.9p a litre, but now that its over a pound, sticking to the 0.9p principle is just silly.
My life is hard, I suffer lots
0/0
 Reply   Quote More 

Reply to All    
 

1–20

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats