rounding

josorens

New Member
Joined
Jan 20, 2004
Messages
3
hi there,

problem:

I need to roundup numbers to nearest 5 or 9.

example:
142,95 to 145,00
92,54 to 95,00
97,02 to 99,00

I tried using the round functions, but didnt get any good results.

Do you have a suggestion?

Thanks and cheers
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
If you wanted it to be in one cell then the formula is:
=MIN(ROUNDDOWN(ROUNDUP(B12;0)/10;0)*10+9;CEILING(B12;5))
 
Upvote 0
Thanks for your help! however I ran into a problem with your formula :)

Initially I wanted the formula to roundup to nearest 5 or 9.

If I use your formula, the number 39,99 rounds up to 40 instead of the nearest roundup to 45.

Can you fix this please?

Cheers (y)
 
Upvote 0
One possibility:

=FLOOR(A1,10)+IF(MOD(A1,10)<=5,5,IF(MOD(A1,10)<=9,9,15))

[EDIT] But probably better as:

=FLOOR(A1,10)+IF(A1=0,0,IF(MOD(A1,10)<=5,5,IF(MOD(A1,10)<=9,9,15)))
 
Upvote 0

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top