SpreadJS Documentation
TRUNC

This function removes the specified fractional part of the specified number.

Syntax

TRUNC(value,precision)

Arguments

This function has these arguments:

Argument Description
value Number to truncate
precision Integer representing the precision; if greater than zero, truncates to the specified number of decimal places; if zero (or not specified), truncate to the nearest whole number; if less than zero, rounds the value left of the decimal to the nearest order of tens

Remarks

The TRUNC and INT functions are similar in that both can return integers. Use the TRUNC function to remove the decimal portion of the number; the TRUNC function does not round up or down. Use the INT function to round numbers down to the nearest integer based decimal portion of the number.

These functions differ also when using negative numbers: TRUNC(–4.2, 0) returns –4, but INT(–4.2) returns –5 because –5 is the lower number.

Data Types

Accepts numeric data for both arguments. Returns numeric data.

Examples

TRUNC(B16)

TRUNC(R16C2)

TRUNC(5.745) gives the result 5

TRUNC(-5.745) gives the result -5

TRUNC(5.745,2) gives the result 5.74

TRUNC(PI()) gives the result 3

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.