Round a number to two decimal places

This tutorial shows how to round a number to two decimal places through the use of Excel or VBA

Example: Round a number to two decimal places

Round a number to two decimal places

METHOD 1. Round a number to two decimal places

EXCEL

=ROUND(B5,C5)
This formula uses the Excel ROUND function to round the selected number in cell B5 to two decimal places by using the value of 2 as the num_digit.

METHOD 1. Round a number to two decimal places using VBA

VBA

Sub Round_to_two_decimal_places()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'round a number to two decimal places
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 two decimal places 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 two decimal places.
Worksheet Selection: Select the worksheet which captures the number that you want to round to two decimal places 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 about the formula used to round to two decimal places

EXPLANATION

EXPLANATION
This tutorial shows how to round a number to two decimal places through the use of Excel or VBA.
FORMULAS
=ROUND(number, 2)
ARGUMENTS
number: The number that is to be rounded to two decimal places.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to round to the nearest thousand using Excel and VBA
How to round to the nearest million using Excel and VBA
How to round up a number using Excel and VBA
How to round down a number using Excel and VBA
How to round a number to the nearest integer using Excel and VBA

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel ROUND function returns a rounded number in accordance with the specified number of digits