Formats a numeric expression and returns it as a string.
Format (number, format)
Number - (Input, expression, Required)
Specifies the number to be formatted.
Format - (Input, expression, Required)
Specifies a formatting string, which determines how the number will be converted.
The following table shows the special characters that may be used within the format string:
Empty string |
Displays the number without any formatting. |
0 |
Digit placeholder. |
# |
Digit placeholder. |
. |
Decimal placeholder. |
, |
Thousand separator. |
% |
Percentage placeholder. |
E- E+ e- e+ |
Scientific notation. |
\ |
Literal characters. |
“ABC” |
String literals. |
Any others |
All other characters (not listed above) are simply inserted one-for-one as literal characters into the final resulting string. |
A format expression may have one, two or three sections, each delimited by a semi-colon (;) character. The following explains how the use of each section works:
A string containing the formatted number.
Format (123.456, “”) |
Returns “123.456” |
Format (123.456, “0”) |
Returns “123” |
Format (123.456, “0.00”) |
Returns “123.46” |
Format (123.456, “$#,##0.00;($#,##0.00)”) |
Returns “$123.46” |
Format (-123456, “$#,##0.00;($#,##0.00)”) |
Returns " ($123,456.00)" |
Format (123.456, “0%”) |
Returns “12346%” |
Format (123.456, “0.00e+00”) |
Returns “1.23e+02” |
Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.
Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function
© 2004-2021 looksoftware. All rights reserved.