Skip to main content

DOLLAR

Converts a number to text, using a currency format $#.##.

Syntax​

expression.DOLLAR(arg1, arg2);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | number | stringA number, a reference to a cell containing a number, or a formula that returns a number.
arg2OptionalApiRange | ApiName | numberA number of digits to the right of the decimal point. The number is rounded as necessary. If it is omitted, the function will assume it to be 2.

Returns​

string

Example​

Convert a number to text using currency format with dollar sign.

// Format numeric values as currency strings with specified decimal places.

// Use the DOLLAR function to convert numbers to formatted currency text.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.DOLLAR(98.9997, 3));