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 to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Guitarde

Board Regular
Joined
Mar 18, 2003
Messages
238
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))
 

josorens

New Member
Joined
Jan 20, 2004
Messages
3
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)
 

rrdonutz

Well-known Member
Joined
Jan 15, 2003
Messages
564
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)))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,322
Messages
5,769,452
Members
425,548
Latest member
macjagger17

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
Top