Name
FormatCurrency, FormatNumber, FormatPercent Functions
Syntax
FormatCurrency(number[,DecimalPlaces][, _IncLeadingZero[,UseParenthesis[,GroupDigits]]]]) FormatNumber(number[,DecimalPlaces][, _IncLeadingZero[,UseParenthesis[,GroupDigits]]]]) FormatPercent(number[,DecimalPlaces][, _IncLeadingZero[,UseParenthesis[,GroupDigits]]]])
-
number Use: Required
Data Subtype: Any numeric expression
The number to be formatted.
-
DecimalPlaces Use: Optional
Data Subtype: Long
Number of digits the formatted string should contain after the decimal point.
-
IncLeadingZero Use: Optional
Data Subtype: Long
Indicates if the formatted string is to have a before floating-point numbers between 1 and -1.
-
UseParenthesis Use: Optional
Data Subtype: Long
Specifies whether parentheses should be placed around negative numbers.
-
GroupDigits Use: Optional
Data Subtype: Long
Determines whether digits in the returned string should be grouped using the delimiter specified in the computer’s regional settings. For example, on English language systems, the value 1000000 is returned as 1,000,000 if
GroupDigitsisTrue.
Return Value
String
Description
The three functions are almost identical. They all take identical
arguments, the only difference being that
FormatCurrency returns a formatted number
beginning with the currency symbol specified in the computer’s
regional settings, FormatNumber returns just the
formatted number, and FormatPercent returns the
formatted number followed by a percentage sign
(%).
Rules at a Glance
If
DecimalPlaces ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access