Skip to main content

FIXED

Rounds a number to the specified number of decimals and returns the result as text with or without commas.

Syntax

expression.FIXED(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe number to round and convert to text.
arg2OptionalApiRange | ApiName | numberThe number of digits to the right of the decimal point. If omitted, the function will assume it to be 2.
arg3OptionalApiRange | ApiName | booleanSpecifies whether do display commas in the returned text (false or omitted) or not (true).

Returns

string

Example

Format a number to a fixed number of decimal places in a spreadsheet.

// How do I display a number with a specific number of decimals in a spreadsheet?

// Round and format a number as text with optional thousand separators in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.FIXED(1234.9, 1, false));