跳到主要内容

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

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe number which will be truncated.
arg2OptionalApiRange | ApiName | numberA number specifying the precision of the truncation. If this argument is omitted, it is equal to 0 (zero).

Returns

number

Example

let worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
worksheet.GetRange("A1").SetValue(func.TRUNC(3.14159265, 5));