跳到主要内容

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

This example shows how to convert a number to text, using a currency format $#.##.

// How to convert a number to text.

// Use function to get text from a number using dollar format.

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