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:
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,460
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.
 
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,168,024
Messages
5,856,875
Members
431,837
Latest member
megantang

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