Contact

TRUNC Function (OpenOffice Calc)

Math Beginner OpenOffice Calc Introduction not established

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, examples and any stated test scope below. How formula examples are checked

Availability and version history

  • Introduced: Documented by Apache OpenOffice 4.1.16; original introduction not established.
  • Availability: Supported in Apache OpenOffice 4.1.16, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

TRUNC removes digits toward zero, either after the decimal point or to a requested decimal position. OpenOffice Calc supports the optional second argument. It is not limited to the one-argument form and is not equivalent to INT for negative nonintegral inputs.

Syntax and arguments

=TRUNC(number; digits)
=TRUNC(number)

number is a numeric value or expression. Optional digits defaults to 0. A positive value keeps decimal places; a negative value discards digits to the left of the decimal point. The 4.1.16 function registry and help explicitly include this optional parameter. Use an integer precision value so the intended operation is clear.

Formula Expected result
=TRUNC(7.9) 7
=TRUNC(7.1) 7
=TRUNC(-7.1) -7
=TRUNC(-7.9) -7
=TRUNC(12.987;2) 12.98
=TRUNC(-12.987;2) -12.98
=TRUNC(129;-1) 120
=TRUNC(-129;-1) -120

=INT(-7.1) instead returns -8. Neither direction is universally “neutral”; the correct choice depends on whether you need truncation or lower-bound rounding.

OpenOffice Calc supports TRUNC(number;digits). Omitting digits means zero; TRUNC moves toward zero, unlike INT for negative nonintegral inputs.

Reproducible worksheet: discard excess precision

Put Raw in A1 and Truncated in B1. Enter 12.987, -12.987, 7 and 0 in A2:A5. Put the required precision 2 in D1. In B2 enter =TRUNC(A2;$D$1) and fill through B5. Expected results are 12.98, -12.98, 7 and 0.

Format B2:B5 with two decimal places if you want to display 7.00 and 0.00. That display does not change the numeric values to text. Change D1 to 0 and the formula results become 12, -12, 7 and 0. Keep column A intact so the original readings remain available.

Advanced applications

Complete groups. =TRUNC(A1/12) gives 2 for A1=29. With A1=-29 it gives -2, so it is a signed arithmetic truncation rather than a lower-bound bucket calculation. For nonnegative capacity calculations, validate both the quantity and the positive divisor.

Fractional portion with its original sign. =A1-TRUNC(A1) gives -0.75 for A1=-7.75. =MOD(A1;1) instead gives 0.25. These answer different questions about the same number.

Date and time. =TRUNC(A1) extracts the day serial from an ordinary positive numeric datetime. For =DATE(2026;10;15)+TIME(13;30;0) it returns the serial for 15 October 2026. Format the result as a date. Do not use TRUNC to parse a text date or assume it floors negative serial values like INT.

Pagination. Starting at worksheet row 1, =TRUNC((ROW()-1)/50)+1 assigns rows 1–50 to page 1. If data start in row 2, use =TRUNC((ROW()-ROW($A$2))/50)+1 within the data rows so the header does not consume a slot.

Other retained patterns. =TRUNC(A1/B1) truncates a quotient, provided B1 is nonzero. =TRUNC(Sheet1.A1) reads another sheet. =TRUNC(RAND()*100) has the intended range 0–99 for RAND in [0,1), but recalculates and should not serve as a permanent record identifier.

Errors and troubleshooting

  • Do not discard decimals from an imported identifier merely because it looks numeric. Identifiers may depend on leading zeros, exact digits or separators; preserve and validate them as text where appropriate.
  • TRUNC is not an aggregation function that ignores text, logical values or errors. Validate intended numeric cells with ISNUMBER and correct upstream errors.
  • A blank, an empty-string formula and numeric zero are different inputs. Do not diagnose them all as the same invalid-argument error.
  • Formatting a cell with no decimals does not apply truncation. Keep a separate formula when the stored result must change.
  • Precision is finite. Truncation cannot recover lost digits, and boundary calculations should be checked on the installed release when exact results are consequential.
  • FLOOR has product-specific significance and mode rules; avoid substituting it solely on the assumption that every rounding function has the same behavior for negatives.
Preserve original measurements and identifiers. Put a truncated numeric result in a helper column only when the required precision rule calls for it.

Documentation and verification

The OpenOffice TRUNC reference, 4.1.16 math help, and versioned function declaration support the optional precision argument. Expected results were independently checked with decimal arithmetic. No new native OpenOffice or GUI execution is claimed; the retained versioned sources were retrieved on 2026-10-13, not freshly downloaded for this revision.