TRUNC Function (OpenOffice Calc)

Math Beginner OpenOffice Calc Introduced in OpenOffice.org 3.0
truncation rounding integers math numeric-data

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.

Compatibility

β–Ύ

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.

Copyright 2026. All rights reserved.