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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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.
 
Upvote 0
Lol thanks guys! If I knew about this forum before, my work day would have been a lot easier ;)
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,767
Members
449,049
Latest member
greyangel23

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