TRUNC
Truncates a number toward zero, optionally at a specified digit position.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=TRUNC(number, [num_digits])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
num_digits | number | Optional | — |
Remarks
- If
num_digitsis omitted, truncation is to an integer. - Positive
num_digitskeeps decimal places; negative values zero places to the left.
Error cases
- Passing more than two arguments returns
#VALUE!.
Examples
Omit the precision to truncate at the decimal point.
Formula =TRUNC(12.345)
Expected result 12
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Retain two places to the right of the decimal point.
Formula =TRUNC(12.345,2)
Expected result 12.34
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Truncate to a place left of the decimal point.
Formula =TRUNC(127,-1)
Expected result 120
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The number argument cannot be read from nonnumeric text.
Formula =TRUNC("invalid",2)
Expected result #VALUE!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Truncate to two decimal places
Formula =TRUNC(12.3456,2)
Expected result 12.34
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Truncate toward zero at the hundreds place
Formula =TRUNC(-987.65,-2)
Expected result -900
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
How does TRUNC differ from INT for negative numbers?
TRUNC removes digits toward zero, while INT floors toward negative infinity.