Round to the nearest hundred
This tutorial shows how to round a number to the nearest hundred through the use of Excel or VBA
Example: Round to the nearest hundred
=ROUND(B5,C5)
|
This formula uses the Excel ROUND function to round the selected number in cell B5 to the nearest hundredth by using the value of -2 as the num_digit.
|
Sub Round_to_nearest_hundred()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'round a number to the nearest hundred
ws.Range("D5") = Application.WorksheetFunction.Round(ws.Range("B5"), ws.Range("C5"))
ws.Range("D5") = Application.WorksheetFunction.Round(ws.Range("B5"), ws.Range("C5"))
End Sub
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code.
Number to Round: Select the number that you want to round to the nearest hundred by changing the cell reference ("B5"), in the VBA code, to the cell that captures the number. Alternatively, you can change the number in cell ("B5") to the number that you want to round to the nearest hundred.
Worksheet Selection: Select the worksheet which captures the number that you want to round to the nearest hundred by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code.
Number to Round: Select the number that you want to round to the nearest hundred by changing the cell reference ("B5"), in the VBA code, to the cell that captures the number. Alternatively, you can change the number in cell ("B5") to the number that you want to round to the nearest hundred.
Worksheet Selection: Select the worksheet which captures the number that you want to round to the nearest hundred by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
EXPLANATION
This tutorial shows how to round a number to the nearest hundredth through the use of Excel or VBA.
This tutorial shows how to round a number to the nearest hundredth through the use of Excel or VBA.
FORMULAS
=ROUND(number, -2)
=ROUND(number, -2)
ARGUMENTS
number: The number that is to be rounded to the nearest hundred.
number: The number that is to be rounded to the nearest hundred.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Round to the nearest thousand | How to round to the nearest thousand using Excel and VBA | |
Round to the nearest million | How to round to the nearest million using Excel and VBA | |
Round up a number | How to round up a number using Excel and VBA | |
Round a number | How to round a number to the nearest integer using Excel and VBA | |
Round a number to two decimal places | How to round a number to two decimal places using Excel and VBA |
RELATED FUNCTIONS
Related Functions | Description | Related Functions and Description |
---|---|---|
ROUND Function | The Excel ROUND function returns a rounded number in accordance with the specified number of digits |