FUNCTION:  FORMATNUMBER( )

FORMATNUMBER(Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigit)

The FORMATNUMBER function return a formatted number value for the numeric expression.


There is one mandatory argument.

Expression

The Expression argument is the number to be converted to a formatted number.

Code:
<% =FORMATNUMBER(12345) %>

Output:
12,345.00

Note that this function rounds off values.

Code:
< =FORMATNUMBER(12345.67899) %>

Output:
12,345.68


There are 4 optional arguments.


NumDigitsAfterDecimal
The optional NumDigitsAfterDecimal argument allows you to choose the number of digits after the decimal.

Code:
< =FORMATNUMBER(12345.67899, 4) %>

Output:
12,345.6790


IncludeLeadingDigit
The optional IncludeLeadingDigit argument includes the leading zero.

You must only use the constant or value from the TRISTATE CONSTANTS for this argument.

CONSTANTVALUEDESCRIPTION
TRISTATETRUE-1True, will use options
TRISTATEFALSE 0False, will not use options
TRISTATEUSEDEFAULT-2Use default setting

Code:
< =FORMATNUMBER(.77, 4, -1) %>

Output:
0.7700


UseParensForNegativeNumbers
The optional UseParensForNegativeNumber argument replaces a negative sign with parentheses around the number.

You must only use the constant or value from the TRISTATE CONSTANTS for this argument.

CONSTANTVALUEDESCRIPTION
TRISTATETRUE-1True, will use options
TRISTATEFALSE 0False, will not use options
TRISTATEUSEDEFAULT-2Use default setting

Code:
< =FORMATNUMBER(-12345.67899, 2, 0, -1) %>

Output:
(12,345.68)


GroupDigit
The optional GroupDigit argument allows the use of the options specified in the Regional Settings Properties in the Control Panel to display a number.

You must only use the constant or value from the TRISTATE CONSTANTS for this argument.

CONSTANTVALUEDESCRIPTION
TRISTATETRUE-1True, will use options
TRISTATEFALSE 0False, will not use options
TRISTATEUSEDEFAULT-2Use default setting

Code:
< =FORMATNUMBER(12345.67899, 2, 0, -1, -1) %>

Output:
12,345.68

Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information