Documentation/Calc Functions/TRUNC

From The Document Foundation Wiki
Jump to: navigation, search
Other languages:
English


Function name:

TRUNC

Category:

Mathematical

Summary:

Truncates a number by removing decimal places.

Syntax:

TRUNC(Number; Count)

Returns:

Returns Number with at most Count decimal places. Excess decimal places are simply removed, irrespective of sign.

Arguments:

Number is a real number or a reference to the cell containing that number which you want to truncate.

Count(Optional) is an integer specifying the precision of the truncation. The default value for Count is 0 hence function returns the integer part of the Number.

If Count is non-integer value then the function takes the floor of it, i.e. truncates it to integer.

Additional details:

TRUNC(Number; 0) behaves as INT(Number) for positive numbers, but effectively rounds towards zero for negative numbers.

Gnome-dialog-warning.svg

Warning:
The visible decimal places of the result are specified in Tools > Options > LibreOffice Calc > Calculate.


Examples:

Formula Description Returns
=TRUNC(1.239;2) truncates 1.239 to 2 decimal places 1.23
=TRUNC(-1.234999;3) truncates -1.234999 to 3 decimal places -1.234

Related LibreOffice functions:

ROUND

INT

ODF standard:

Section 6.17.8, part 2

Equivalent Excel functions:

TRUNC