The TRUNC function in Google Sheets is a versatile tool that allows users to simplify numerical values by removing less significant digits. This function is particularly useful when you want to focus on a specific level of precision without rounding the number up or down. By utilizing TRUNC, you can maintain the integrity of your data while presenting it in a cleaner, more organized manner.
Syntax
TRUNC(value, [places])
- value: The number you want to truncate.
- places: (Optional) The number of digits to which you want to truncate the value. If omitted, the default value is 0.
Example #1
TRUNC(123.456, 2)
This function call truncates the number 123.456 to 2 decimal places, resulting in a value of 123.45. If applied, it manages data to focus on necessary decimal details without rounding.
Example #2
TRUNC(987.654321)
This truncates 987.654321 to 0 decimal places (the default), producing a simple integer, 987. This can be useful for dealing with integer values when fractional parts are irrelevant.
Example #3
TRUNC(-12.3456, 3)
Here, the function reduces the negative number to 3 decimal places, resulting in -12.345. This helps in maintaining a certain precision even with negative values during calculations.
Error handling
- VALUE! – This error occurs if the value provided is not a valid number.
- NUM! – This happens when the specified number of places is less than zero.
- REF! – This is shown if a cell reference is invalid.