TRUNC(number, [num_digits])
TRUNC(4.9)
The TRUNC function is used to truncate a number to a specified number of decimal places. For example, this returns 4, which truncates the number 4.9 to the integer 4.
TRUNC(-3.5, 1)
In the example, the TRUNC function is used to truncate the number -3.5 to one decimal place. This returns -3.5, which truncates the number to one decimal place.
TRUNC(3.141593,2)
In the example, the TRUNC function is used to truncate the number 3.141593 to two decimal places. This returns 3.14, which truncates the number to two decimal places.
TRUNC(3.141593,0)
In the example, the TRUNC function is used to truncate the number 3.141593 to zero decimal places. This returns 3, which truncates the number to zero decimal places.
The TRUNC function is a useful tool for removing the decimal part of a number, truncating it to an integer value. It can also be used to extract dates from date and time values and was introduced in MS Excel 2007. It can be used to truncate a number to a given precision.