PrecisionCalc
xl
Precision
Get Your Numbers Right

 

xlpTRUNC

Truncates a number to an integer by removing the fractional part of the number, with up to 32,767 significant digits of precision. Same as Excel's built-in TRUNC function, but with high precision.

Syntax

xlpTRUNC(num,num_digits,format_negative,format_thousands,format_currency,exponential_notation)

num Required. The number to be truncated to an integer.
num_digits Optional. Specifies the precision of the truncation. 0 by default.
format_negative Optional. Determines whether negatives are formatted with a leading hyphen ("-"), or parentheses ("()"). Set to 1 to format negatives with a leading hyphen. Set to 2 for parentheses. 1 by default.

You can also format negatives with a red font.

format_thousands Optional. Determines whether thousands separators are included. Set to TRUE to include thousands separators. FALSE by default.
exponential_notation Optional. Determines whether result is formatted in exponential notation. Set to TRUE to format in exponential notation. FALSE by default.
format_currency Optional. Determines whether currency symbol is included. Set to TRUE to include currency symbol. The currency symbol will be added either to the beginning or to the end of the result, whichever is appropriate for the locale. FALSE by default.

Remarks

Examples

Formula Description Result
=xlpTRUNC(0.1) 0.1 truncated to an integer. 0
=xlpTRUNC(1.1) 1.1 truncated to an integer. 1
=xlpTRUNC(-0.1) -0.1 truncated to an integer. 0
=xlpTRUNC(-1.1) -1.1 truncated to an integer. -1
=xlpTRUNC(456.789,2) 456.789 truncated to two places to the right of an integer. 456.78
=xlpTRUNC(456.789,2,,,TRUE) 456.789 truncated to two places to the right of an integer, and formatted in exponential notation. 4.5678E+2
=xlpTRUNC(456.789,-2) 456.789 truncated to two places to the left of an integer. 400
=xlpTRUNC(-456.789,-2) -456.789 truncated to two places to the left of an integer. -400
=xlpTRUNC(A1,2,TRUE,TRUE) A1 truncated to an integer, formatted with parentheses (if negative), thousands separators, and currency symbol.

See Also

xlpFRAC
xlpROUND
xlpROUNDUP
xlpROUNDDOWN
xlpINT