TRUNC Function (LibreOffice Calc)
The TRUNC function in LibreOffice Calc removes the fractional part of a number without rounding. It truncates toward zero, unlike INT which always rounds down. Learn syntax, examples, common errors, and best practices.
Compatibility
▾| Excel | ✔ |
| Gnumeric | ✔ |
| Google_sheets | ✔ |
| Libreoffice | ✔ |
| Numbers | ✔ |
| Onlyoffice | ✔ |
| Openoffice | ✔ |
| Wps | ✔ |
| Zoho | ✔ |
What the TRUNC Function Does ▾
- Removes the decimal portion of a number
- Always rounds toward zero
- Works with positive and negative numbers
- Can truncate to a specified number of decimal places
- Useful for integer extraction, data cleaning, and non‑rounding math
It is designed to be precise, predictable, and universally compatible.
Syntax ▾
TRUNC(number; [digits])
Arguments
-
number:
The numeric value to truncate. -
digits (optional):
The number of decimal places to keep.- Positive values keep decimals
- Zero removes all decimals
- Negative values truncate to tens, hundreds, etc.
Basic Examples ▾
Remove decimals from a positive number
=TRUNC(5.9)
Returns 5.
Remove decimals from a negative number (toward zero)
=TRUNC(-3.9)
Returns -3.
TRUNC with a cell reference
=TRUNC(A1)
Removes the fractional part of A1.
TRUNC to a specific number of decimal places
=TRUNC(12.3456; 2)
Returns 12.34.
Advanced Examples ▾
TRUNC with negative digits (truncate to tens)
=TRUNC(123.45; -1)
Returns 120.
TRUNC with negative digits (truncate to hundreds)
=TRUNC(987.65; -2)
Returns 900.
Extract the integer part of a number
=TRUNC(12.75)
Returns 12.
TRUNC vs INT comparison
=TRUNC(-5.8)
Returns -5.
=INT(-5.8)
Returns -6.
TRUNC for date/time values
=TRUNC(A1)
Removes the time portion, leaving only the date.
TRUNC in financial modeling
=TRUNC(A1 * 12)
Converts annual values to whole‑month equivalents without rounding.
TRUNC for binning and grouping
=TRUNC(A1 / 10)
Groups values into buckets of 10.
Common Errors and Fixes ▾
TRUNC returns 0 unexpectedly
Possible causes:
- Input value is between -1 and 1
- Number is stored as text
- Cell is empty
Fix:
Convert text to numbers using:
Data → Text to Columns → OK
TRUNC returns unexpected results with negative digits
Cause:
- Negative digits truncate to tens, hundreds, etc., not decimals.
Example:
TRUNC(456; -1) → 450
Err:502 — Invalid argument
Occurs when:
- The argument is non‑numeric text
- A formula returns an error passed into TRUNC
Fix:
Wrap the expression with IFERROR:
IFERROR(TRUNC(A1); 0)
Best Practices ▾
- Use TRUNC when you need to remove decimals without rounding
- Use INT when you need rounding down (toward negative infinity)
- Use ROUND, ROUNDDOWN, or ROUNDUP for controlled rounding
- Use TRUNC for data cleaning and integer extraction
- Use TRUNC with negative digits for coarse grouping
Related Patterns and Alternatives ▾
- Use INT to round down instead of toward zero
- Use ROUND, ROUNDDOWN, or ROUNDUP for precision rounding
- Use FLOOR and CEILING for significance‑based rounding
- Use MOD with TRUNC for grouping and indexing
By mastering TRUNC and its combinations with other math functions, you can build precise, non‑rounding numeric models in LibreOffice Calc that behave consistently across all data scenarios.