Manipulating Round() function in VBA

my-lew

New Member
Joined
Jan 7, 2004
Messages
2
Is it possible to specify how you want a number to be rounded. ie: nearest hundeth, thousanth, ten thousanth, ect.......

given_______want

45570______45600

:unsure:
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
Welcome!

When you use the round function, you need to input a formula in the following format:

=round(number, number of digits)

The "number of digits" specifies how many decimals to round to, as follows:

2 = 2 decimal places
0 = 0 decimal places
-1 = nearest 10
-2 = nearest 100
-3 = nearest 1000

You can also use "ceiling" formala for odd rounding, or roundup or rounddown

:biggrin:
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hello my_lew:

One of the ways to do this would be to use the worksheet function ROUND ... if the entry 45570 is in cell A1, then using the following
Code:
worksheetfunction.RoundUp([a1],-2)
you can get the result as 45600

I am using EXCEL 97 and I seem to have access to the ROUND function only through the worksheet environment.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,222
Messages
5,594,899
Members
413,950
Latest member
solve22

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