Truncate
Truncate
is a mathematical function that removes the specified number of digits from numeric values.
Syntax:
Truncate(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. |
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 3. The first three digits to the right of the decimal point remain, and the following digit is removed:
Truncate(3594.5567,3)=3594.556
The following statement uses a zero (0) integer. All digits to the right of the decimal point are removed:
Truncate(3594.5567,0) = 3594
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.
Truncate(3594.5567, -2) = 3500
Note:
Any formatting previously applied to a cell, column, or row is maintained when you use the Truncate
function. The following example shows the results of a Truncate
function where the cell value was previously formatted to display three decimal places: Truncate(234.567, 0) = 234.000