TRUNC
Truncates a number to an integer by removing the decimal, or fractional, part of the number.
Syntax
expression.TRUNC(arg1, arg2);
expression
- A variable that represents a ApiWorksheetFunction class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
arg1 | Required | ApiRange | ApiName | number | The number which will be truncated. | |
arg2 | Optional | ApiRange | ApiName | number | A number specifying the precision of the truncation. If this argument is omitted, it is equal to 0 (zero). |
Returns
number
Example
- Code
- Result
let worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
worksheet.GetRange("A1").SetValue(func.TRUNC(3.14159265, 5));