Contact

TRUNC Function in ONLYOFFICE Spreadsheet Editor: Syntax, Examples and Limits

Math and Trigonometry Beginner ONLYOFFICE Spreadsheet Editor

Discard digits without rounding: remove the fractional part by default or retain a selected number of decimal places.

Verification status: Twelve truncation cases checked, including four observed ±2.3/two-place precision differences in ONLYOFFICE Desktop Editors Community 10.0.0.169 on Linux x64; additional examples independently calculated. Other clients and builds untested. How formula examples are checked

TRUNC removes fractional places without rounding to the nearest value. With the default zero places, -8.999 becomes -8 rather than the -9 returned by INT. Decimal precision needs extra care: the exact desktop cases below distinguish the intended decimal operation from observed binary-arithmetic behavior.

Availability and version history

  • Introduced: The original introduction release and date are not established by the checked references.
  • Availability: Documented in current ONLYOFFICE help and observed in Desktop Editors Community 10.0.0.169. This is not a final supported-version endpoint.
  • Scope: Native observations cover Linux x64 only. Docs, mobile, earlier versions and other desktop platforms remain separately untested.
  • Checked: October 14, 2026, against the official TRUNC reference, pinned source and the explicitly identified native cases. Additional worked results were independently calculated.

Syntax and the omitted argument

=TRUNC(number, [num_digits])

The official TRUNC reference requires the number and makes num_digits optional, with a default of 0. Brackets indicate optional documentation notation; do not type them into a formula.

For the ordinary integer digit counts used here, 2 selects hundredths, 1 tenths and 0 whole units. Negative counts move the truncation position left of the decimal point; -2 is the hundreds position. The short help text does not explain negative counts in detail. The tested ±1492.6 cases below establish that particular behavior in the named desktop build.

Decimal precision in the tested desktop build

In ONLYOFFICE Desktop Editors Community 10.0.0.169 on Linux x64, =TRUNC(2.3,2) returned 2.29, and =TRUNC(-2.3,2) returned -2.29. Numeric cell references gave the same results. Exact decimal truncation would leave 2.30 and -2.30 unchanged, so this is a material precision difference, not merely a display format.

To reproduce the four tested cases on DecimalBoundary, enter 2.3 in A2 and -2.3 in A3. Enter =TRUNC(A2,2) in B2 and fill to B3. Put =TRUNC(2.3,2) in C2 and =TRUNC(-2.3,2) in C3. The observed B and C columns were 2.29,-2.29. This observation is limited to that installed build and those inputs.

The pinned official SDKJS implementation multiplies by a power of ten, truncates and divides back, and flags floating-point precision in its own source. This is implementation evidence for that revision, not a version history or proof about every deployment.

If an amount must follow a precise decimal policy, check the actual target build and representative values. Adding an arbitrary small offset can change other inputs incorrectly. Replacing TRUNC with ROUND also changes the operation: it is not a universal repair.

Complete mixed-precision worksheet

Create TruncationCases, using A1:C11. Put Number, Truncated value and Places used in A1:C1. Enter A and each individual B formula below; these formulas intentionally use different second arguments, so do not fill one formula through the entire table. C can contain the printed place count or the label Omitted.

Row A: number Formula in B Expected B
2 12.341 =TRUNC(A2,2) 12.34
3 -12.341 =TRUNC(A3,2) -12.34
4 1492.6 =TRUNC(A4,-2) 1400
5 -1492.6 =TRUNC(A5,-2) -1400
6 8.999 =TRUNC(A6) 8
7 -8.999 =TRUNC(A7) -8
8 0.125 =TRUNC(A8,1) 0.1
9 -0.125 =TRUNC(A9,1) -0.1
10 0 =TRUNC(A10) 0
11 15 =TRUNC(A11) 15

Rows 2–9 match the eight additional numeric-reference cases run in the same desktop build, including the omitted argument and both negative-place examples. Rows 10–11 and the following vendor/advanced exercises are independently checked expectations, not additional native tests.

On a separate VendorTruncation sheet, put 3.567,4.99879,3.14159265 in A1:A3 and 2,1,5 in B1:B3, without headers in those cells. Enter =TRUNC(A1,B1) in C1 and fill through C3. The official illustration displays 3.56,4.9,3.14159. Those source-illustrated values are distinct from the desktop test record.

Compare truncation with integer flooring

On WholePart, put -4.3 in A2, then B2 =TRUNC(A2) and C2 =INT(A2). The mathematical targets are -4 and -5. Both functions give 4 for positive 4.3, but that agreement does not extend to negative fractions.

For a separate two-place example, enter 27.689 and -27.689 in A4:A5, and =TRUNC(A4,2) in B4 filled through B5. The expected values are 27.68 and -27.68. Removing places does not change the result to the nearest hundredth, and it does not always move toward negative infinity.

Advanced: full packs, leftovers and enough packs

Create Packing, with headers Items, Pack size, Full packs, Leftovers, Packs needed and Reconstruction in A1:F1. Put 53 in A2 and 12 in B2.

  • C2: =TRUNC(A2/B2) → 4
  • D2: =A2-B2*C2 → 5
  • E2: =ROUNDUP(A2/B2,0) → 5
  • F2: =B2*C2+D2 → 53

Four full packs leave five items. Five packs are needed to hold every item, allowing the last pack to be incomplete. These are different questions, so using TRUNC for the required capacity would understate it.

This packing model requires nonnegative integer item counts and a positive integer pack size. Keep signs and fractional measurements out unless the model explicitly defines them. ROUNDUP supplies the capacity calculation.

Errors and portability

Use integer place counts in these exercises. Fractional num_digits, extreme counts, text inputs, blank cells and array behavior are not established by these scalar tests. Display formats do not correct a stored result. Keep original data alongside calculated values and compare a representative workbook after an editor or version change.

INT floors, ROUND rounds to a chosen precision, and MOD gives a remainder. Choose the operation before copying a formula from another program.