Round up a number

To round up a number we need to apply the Excel ROUNDUP function

Example: Round up a number

Round up a number

METHOD 1. Round up a number

EXCEL

=ROUNDUP(B5,C5)
The formula uses the Excel ROUNDUP function to round up the selected number in cell B5 to the nearest integer.

METHOD 1. Round up a number using VBA

VBA

Sub Round_up_a_number()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to round up a number
ws.Range("D5") = Application.WorksheetFunction.RoundUp(ws.Range("B5"), ws.Range("C5"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named Analysis.
Value to Round: If using the exact VBA code ensure that the value that you want to round up is captured in cell ("B5").
Number of Digits: The value (0) in cell ("C5") represents the number of digits that the selected number should be rounded. 0 represents a rounding to the nearest integer.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
Value to Round: Select the value that you want to round up by changing the cell reference ("B5") in the VBA code to any cell in the worksheet that contains the value that you want to round up and doesn't conflict with the formula.
Number of Digits: You can select the cell that contains the number of digits, which in this example will be 0, by changing the cell reference ("C5") to any cell in the worksheet that contains a value of 0 and doesn't conflict with the formula. You can also hardcode the number of digits directly into the VBA code by replacing ws.Range("C5") with 0.

Explanation about the formula used to round up a number

EXPLANATION

EXPLANATION
To round up a number we need to apply the Excel ROUNDUP function.
FORMULAS
=ROUNDUP(number, num_digits)

ARGUMENTS
number: The number that is to be rounded up.
num_digits: The number of digits that the specified number will be rounded up to. In this example we have assigned a value of 0 to num_digits argument, meaning that the value will be rounded up to the nearest integer.