Easy Tutorial
❮ Func Mid Func Rgb ❯

VBScript FormatNumber Function



The FormatNumber function returns an expression formatted as a number.

Syntax

Parameter Description
expression Required. The expression to be formatted.
NumDigAfterDec Optional. A numeric value indicating the number of digits to display to the right of the decimal point. The default is -1 (uses the computer's regional settings).
IncLeadingDig Optional. Indicates whether to display a leading zero for fractional values: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False
UseParForNegNum Optional. Indicates whether to place negative values within parentheses: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False
GroupDig Optional. Indicates whether to group numbers using the digit group symbols specified in the computer's regional settings: -2 = TristateUseDefault - Uses the computer's regional settings<br> -1 = TristateTrue - True <br> 0 = TristateFalse - False

Example

Example 1

Output of the above example:

Example 2

Setting the number of digits after the decimal point:

Output of the above example:

Example 3

Whether to display a leading zero for fractional values:

Output of the above example:

Example 4

Whether to place negative values within parentheses:

Output of the above example:

Example 5

Whether to group numbers:

Output of the above example:


❮ Func Mid Func Rgb ❯