Contact

TRUNC Function (OpenOffice Calc)

Math Beginner OpenOffice Calc OpenOffice.org 3.0

The TRUNC function in OpenOffice Calc removes the fractional part of a number by truncating toward zero. Learn syntax, behavior with negative numbers, examples, and best practices.

Verification status: Consult the documentation and examples below. Native application testing has not been documented for this guide. How formula examples are checked

The TRUNC function in OpenOffice Calc removes the fractional part of a number by truncating it toward zero. Unlike INT, which always rounds downward, TRUNC simply chops off the decimals without changing the sign direction.

What the TRUNC Function Does

  • Removes the decimal portion of a number
  • Always rounds toward zero
  • Works with positive and negative numbers
  • Useful for ID extraction, integer math, and formatting logic
  • Works across sheets

TRUNC is ideal when you need clean integer extraction without directional rounding.

Syntax

TRUNC(number)

Arguments:

  • number — Any numeric value or formula result

TRUNC is different from INT:

  • TRUNC → toward zero
  • INT → toward negative infinity

Behavior With Positive and Negative Numbers

Input TRUNC Result Explanation
7.9 7 Fraction removed
7.1 7 Fraction removed
-7.1 -7 Toward zero
-7.9 -7 Toward zero

This makes TRUNC safer than INT when working with negative values.

Basic Examples

Remove decimals from a number

=TRUNC(7.9)

Result: 7

Truncate a negative number

=TRUNC(-7.9)

Result: -7

Truncate a formula result

=TRUNC(A1 / B1)

TRUNC with cell reference

=TRUNC(A1)

Advanced Examples

Extract integer part of a division

=TRUNC(A1 / 12)

Useful for converting months to years, items to boxes, etc.

TRUNC for ID or code extraction

=TRUNC(A1)

Useful when numeric IDs contain decimals due to import issues.

TRUNC for date/time calculations

Extract whole days from a datetime:

=TRUNC(A1)

TRUNC across sheets

=TRUNC(Sheet1.A1)

TRUNC for pagination logic

Page number from row:

=TRUNC((ROW()-1) / 50) + 1

TRUNC for random integer ranges

=TRUNC(RAND() * 100)

Returns 0–99.

TRUNC with optional decimal places (LibreOffice only)

LibreOffice supports:

TRUNC(number; digits)

OpenOffice Calc does not support the second argument.

Comparison: TRUNC vs INT vs FLOOR

Function Rounds Toward Example: -7.1 Notes
TRUNC 0 -7 Removes decimals
INT −∞ -8 Always down
FLOOR −∞ -8 Down to a multiple

TRUNC is the most neutral of the three.

Common Errors and Fixes

TRUNC returns Err:502 (Invalid argument)

Occurs when:

  • Input is text
  • Input is empty
  • A malformed reference is used

TRUNC returns unexpected values

Possible causes:

  • Confusing TRUNC with INT
  • Text numbers not converted to numeric
  • Hidden spaces in cells

TRUNC ignores values you expected it to include

TRUNC ignores:

  • Text numbers ("123")
  • Empty cells
  • Logical values
  • Errors

TRUNC includes values you expected it to ignore

TRUNC includes:

  • Dates
  • Times
  • Numeric results of formulas

Err:508 — Missing parenthesis

Usually caused by:

  • Missing )
  • Using commas instead of semicolons

Best Practices

  • Use TRUNC when you need neutral truncation
  • Use INT when rounding must go downward
  • Use FLOOR when rounding to a multiple
  • Convert imported text numbers to real numbers
  • Use named ranges for cleaner formulas
TRUNC is perfect for clean integer extraction, especially when negative numbers are involved — it avoids the directional bias of INT.