Round number to xx9 number function

BOGIA

Active Member
Joined
May 23, 2005
Messages
266
Hi all,

Could someone help to convert numbers below to 9 before .cent value by using function "ROUND" or VB code.

I have in column A numbers like 183.35, 195.57, 220.01 etc... expecting the results should be 179.00, 199.00, 219.00 etc... in column B. Please see the sample below:

183.35 179
195.57 199
220.01 219
207.79 209
195.57 199
183.35 179
195.57 199
207.79 209
195.57 199
207.79 209
207.79 219

Thanks heaps.

cheers,
bogia
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

dafan

Well-known Member
Joined
May 6, 2008
Messages
692
It's pretty nasty, and doesn't use ROUND or VBA but it does the trick :P

This goes in B1 if your number is in A1, drag down
Code:
=IF(ABS(A1-((LEFT(A1,2)) & "9"))>ABS(A1-(((LEFT(A1,2)) & "9")-10)),(((LEFT(A1,2)) & "9")-10),((LEFT(A1,2)) & "9"))

Hope it helps, even though it doesn't meet your requirements.

If you want it to work with numbers above 1000 to, use this (even nastier).
Code:
=IF(ABS(A1-((LEFT(A1,(LEN(A1)-4))) & "9"))>ABS(A1-(((LEFT(A1,(LEN(A1)-4))) & "9")-10)),(((LEFT(A1,(LEN(A1)-4))) & "9")-10),((LEFT(A1,(LEN(A1)-4))) & "9"))

In this case I assumed your numbers always are xxx.xx.
 
Last edited:
Upvote 0

BOGIA

Active Member
Joined
May 23, 2005
Messages
266
Hi Stefan and Mike,

Thanks both for your expert help. They all work well.

Thanks again for your quick reply.

cheers,
bogia
 
Upvote 0

Forum statistics

Threads
1,191,707
Messages
5,988,198
Members
440,138
Latest member
yanaa

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