Round numbers based on last digit

nchiari

New Member
Joined
Mar 2, 2016
Messages
12
Hi again guys! Thanks to you I'm optimizing a lot my worksheet! I have another question to ask you.

AQ2: =(AO2-AP2). That ecuation gives me a result that I need to round with the next criteria:


  • If the result ends with the digits: 2, 3, 4, round it to end with 5 (ie. 102, 103, 104, round to 105)
  • If the result ends with the digits: 7, 8, 9, round it to end with the next 0 (ie. 107, 108, 109, round to 110)
  • If the result ends with the digit: 1, round it to end with the previous 0 (ie. 101, round to 100)
  • If the result ends with the digit: 6, round it to end with the previous 5 (ie. 106, round to 105)

I googled it a bit and found this formula, but I don't know how to change it to work for my case:

=AQ2+CHOOSE(MOD(AQ2;10)+1;-1;-2;-3;1;0;0;3;2;1;0)

Thanks again!!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

nchiari

New Member
Joined
Mar 2, 2016
Messages
12
PS: remember that I also need that the same cell with the round formula first have a (XX-XX) formula to obtain the number who's gonna be rounded.
 

XOR LX

Well-known Member
Joined
Jul 2, 2012
Messages
4,517

ADVERTISEMENT

Hi.

=MROUND((XX-XX)+1,5)


Regards
 

nchiari

New Member
Joined
Mar 2, 2016
Messages
12
Lol thanks guys! If I knew about this forum before, my work day would have been a lot easier ;)
 
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,164,195
Messages
5,835,918
Members
430,394
Latest member
Ace_Quared

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