TRUNC

Truncate a number to a given precision

Related Functions

Sponsored Link

Purpose 

Truncate a number to a given precision

Return value 

A truncated number

Syntax 

=TRUNC (number, [num_digits])

Arguments 

  • number - The number to truncate.
  • num_digits - [optional] The precision of the truncation (default is 0).

Usage notes 

Use the TRUNC function to remove the fractional part of a number and return just the integer. For example, TRUNC(4.9) will return 4, and TRUNC(-3.5) will return -3. TRUNC does not do any rounding, it simply returns the integer part of the number.

TRUNC can also be used to return a set number of decimal places without rounding, using the num_digits argument. For example, TRUNC (PI(), 2) will return 3.14 and TRUNC (PI(), 3) will return 3.141.

Note; TRUNC and INT are similar functions because they both can return the integer part of a number. However, TRUNC simply truncates a number, while INT actually rounds a number down to an integer. With positive numbers, and when TRUNC is using the default of 0 for num_digits,  both functions return the same reults. With negative numbers, the results can be different. INT(-3.1) returns -4, because INT rounds down to the lower integer. TRUNC(-3.1) returns -3.

If you simply want the integer part of a number, you should use TRUNC.

Sponsored Link

0 votes. 0 / 5