TRUNC

Returns the integer part of the number passed to the function.

Syntax

= TRUNC(value)

Parameters

value

A number whose integer part is to be extracted.  The number can be specified as an integer (e.g., 37), a decimal value (e.g., 37.48), as a string, or as the value of a variable (e.g, UnitPrice).

Return Type

Decimal number.

In the case of an error, the function displays an error message: “TRUNC(number): Error message”

The function can be used in combination with other functions.

Examples

Example

Returns

= TRUNC(1.789)

1

= TRUNC(-2.789)

-2

= TRUNC(“100.83%”)

1

= TRUNC(UnitPrice)

The truncated value of the UnitPrice

= TRUNC(“abcd”)

Displays message “TRUNC(abcd): Input string was not in a correct format.”

= POWER(TRUNC(UnitPrice), 2)

The square of the truncated value of UnitPrice

= MAX(TRUNC(UnitPrice), 12)

The maximum among the truncated value of UnitPrice and the number 12.