Skip to main content

ROUND

Rounds a number to a specified number of digits.

Syntax​

expression.ROUND(arg1, arg2);

expression - A variable that represents an ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe number to round.
arg2RequiredApiRange | ApiName | numberThe number of digits to round to. If this argument is negative, the number will be rounded to the left of the decimal point. If it is equal to zero, the number will be rounded to the nearest integer.

Returns​

number

Example​

Round a number to a specific decimal place in a spreadsheet.

// How do I round numbers to a certain number of digits in a spreadsheet?

// Adjust a number's precision by rounding it in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.ROUND(3.456, 2));