Truncate/Truc
Truncate
is a mathematical function that removes the specified number of digits from numeric values.
Syntax:
Trunc(arg1,integer)
where arg1 is one of the following values:
Argument | Description |
---|---|
numeric |
A numeric value. For example, 234.567. See Numeric Arguments. |
row, column, or cell reference |
A pointer to a row, column, or cell within a grid. You can specify references in several ways. The reference syntax is: |
function |
An embedded function. |
Integer
specifies the number of digits to remove:
-
A positive
integer
determines the number of digits to the right of the decimal point. -
A zero (0)
integer
returns the integer located to the left of the decimal point. -
A negative
integer
indicates the number of digits to the left of the decimal point.
Examples:
The following statement uses a positive integer of 2. The first two digits to the right of the decimal point remain, and the following digit is removed:
Trunc(234.567, 2) = 234.56
The following statement uses a zero (0) integer. All digits to the right of the decimal point are removed:
Trunc(234.567, 0) = 234
The following statement uses a negative integer of -2. All digits to the right of the decimal point are removed and the last 2 digits of the integer are truncated.
Trunc(234.567, -2) = 200
Note:
Any formatting previously applied to a cell, column, or row is maintained when you use the Trunc
function. The following example shows the results of a Trunc
function where the cell value was previously formatted to display three decimal places: Trunc(234.567, 0) = 234.000