VBScript FormatCurrency Function
Complete VBScript Reference Manual
The FormatCurrency function returns an expression formatted as a currency value, using the currency symbol defined in the computer's system Control Panel.
Syntax
FormatCurrency(Expression[,NumDigAfterDec[,
IncLeadingDig[,UseParForNegNum[,GroupDig]]]])
| Parameters | Description |
|---|---|
| expression | Required. The expression to be formatted. |
| NumDigAfterDec | Optional. A numeric value indicating the number of digits displayed to the right of the decimal point. The default is -1 (using the computer's regional settings). |
| IncLeadingDig | Optional. Indicates whether to display leading zeros for decimal values:
|
- -2 = TristateUseDefault - Uses the computer's regional settings
- -1 = TristateTrue - True
- 0 = TristateFalse - False
- -2 = TristateUseDefault - Uses the computer's regional settings
- -1 = TristateTrue - True
- 0 = TristateFalse - False
Example
Example 1
The example above produces the following output:
$20,000.00
Try it »
Example 2
Set the number of digits after the decimal point:
The example above produces the following output:
$20,000.00
$20,000.00000
Try it »
Example 3
Whether to display leading zeros for decimal values:
The example above produces the following output:
$.20
$0.20
Try it »
Example 4
Whether to place negative values in parentheses:
The example above produces the following output:
-$50.00
($50.00)
Try it »
Example 5
Whether to group one million dollars:
The example above produces the following output:
$1000000.00
$1,000,000.00
Try it »
Complete VBScript Reference Manual