Round number up to nearest whole 5 or 9

ChalkyExcel

New Member
Joined
Jul 30, 2016
Messages
4
I have a sheet with the following numbers:

1012
2037
1083
1080

I would like the numbers above the be rounded up to the nearest 5 or 9. So for the example above the finished result would be:

1015
2039
1085
1079

Any help very much appreciated. Thank you.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Welcome to the MrExcel board!

Your thread title and problem examples do not match. Your thread title asks for numbers to be rounded up, but your final example is rounded down. Please clarify.
 
Upvote 0
This works for your sample data:

=IF(RIGHT(A1,1)="0",A1-1,IF(RIGHT(A1,1)<="4",A1+(5-RIGHT(A1,1)),A1+(9-RIGHT(A1,1))))
 
Upvote 0
Welcome to the MrExcel board!

Your thread title and problem examples do not match. Your thread title asks for numbers to be rounded up, but your final example is rounded down. Please clarify.

Apologies - yes rounded up to nearest 5 or 9 please.
 
Upvote 0
OK. Try this, then:

=IF(RIGHT(A1,1)<="4",A1+(5-RIGHT(A1,1)),A1+(9-RIGHT(A1,1)))

or perhaps this:

=IF(RIGHT(A1,1)="0",A1,IF(RIGHT(A1,1)<="4",A1+(5-RIGHT(A1,1)),A1+(9-RIGHT(A1,1))))
 
Last edited:
Upvote 0
This one works a charm thank you very much!
Hmm, I would have thought that a number that already ends with a 5 or a 9 would not be changed - at least that is how 'normal' rounding works. Those formulas do not change a number that ends in 9 but they do change numbers that end in 5. :confused:

If you did in fact want to leave such numbers unchanged, one way would be.

=A1+CHOOSE(RIGHT(A1,1)+1,5,4,3,2,1,0,3,2,1,0)
 
Upvote 0
Those formulas do not change a number that ends in 9 but they do change numbers that end in 5. :confused:

That's true, but could easily be amended thus:

=IF(RIGHT(A1,1)="5",A1+4,IF(RIGHT(A1,1)<="4",A1+(5-RIGHT(A1,1)),A1+(9-RIGHT(A1,1))))
 
Last edited:
Upvote 0
That's true, but could easily be amended thus:

=IF(RIGHT(A1,1)="5",A1+4,IF(RIGHT(A1,1)<="4",A1+(5-RIGHT(A1,1)),A1+(9-RIGHT(A1,1))))
I'm not sure what is different about that, it still rounds 1085 to 1089.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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