FormatNumber

This function formats an expression as a number.

Syntax

FormatNumber(Expression, [NumDigitsAfterDecimal], [IncludeLeadingDigit], [UseParensForNegativeNumbers], [GroupDigits])

Parameters

Expression
Required. Expression to be formatted.
NumDigitsAfterDecimal
Optional. Numeric value that indicates how many places to the right of the decimal are displayed. Default value is –1, which indicates that the computer's regional settings are used.
IncludeLeadingDigit
Optional. Tristate constant that indicates whether or not a leading 0 is displayed for fractional values. The following table shows the settings for IncludeLeadingDigit.
Constant
Value
Description
TristateTrue –1 True.
TristateFalse 0 False.
TristateUseDefault –2 Use the setting from the computer's regional settings.

UseParensForNegativeNumbers
Optional. Tristate constant that indicates whether or not to place negative values within parentheses. The following table shows the settings for the UseParensForNegativeNumbers parameter.
Constant
Value
Description
TristateTrue –1 True.
TristateFalse 0 False.
TristateUseDefault –2 Use the setting from the computer's regional settings.

GroupDigits
Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. The following table shows the settings for the GroupDigits parameter.
Constant
Value
Description
TristateTrue –1 True.
TristateFalse 0 False.
TristateUseDefault –2 Use the setting from the computer's regional settings.

Return Values

Returns a formatted number.

Remarks

The regional settings of your desktop computer provide values for omitted parameters.

The Number tab of the regional settings provides all settings information.