Number Format

In the field:
{
expression
Format
format
}
where
expression
is a decimal number or a whole number, the
format
is either a pre-defined format or a general format.

Pre-defined formats

The following table contains the pre-defined formats for number values:
Format
Description
"currencydigits"
digit characters to 2 decimal places with prefix/suffix currency symbols (e.g. "$1,003.50"). The 2 decimal places are not enforced for whole number currency amounts.
"currencywords"
the currency value expressed as words (e.g. "One Thousand and Three Dollars and Fifty Cents")
"currencywordslow"
if the value is between 0-9 then "currencywords" otherwise "currencydigits" equivalent to the format-by-value text "0-9=currencywords|currencydigits"
"digits"
simply the digit characters for the number (e.g. "1003.5")
"nth"
the ordinal value expressed as digits (e.g. "1003rd")
"th"
the suffix for the ordinal value (e.g. "rd")
"thousands"
the digit characters with thousand-point separators (e.g. "1,003")
"words"
the cardinal value expressed as words (e.g. "One Thousand and Three")
"wordslow"
if the value is between 0-9 then "words" otherwise "digits" equivalent to the format-by-value text "0-9=words|digits"
"wth"
the ordinal value expressed as words (e.g. "One Thousand and Third")
"wthlow"
if the value is between 0-9 then "wth" otherwise "nth" equivalent to the format-by-value text "0-9=wth|nth"
"Fraction"
fractional formatting to the nearest half, quarter or eighth as words eg: One Half, Three Quarters or Seven Eigths
"Fraction/2/3/6/9"
fractional formatting to the nearest half, third , sixth or ninth as words eg: One Third, Seven Ninths
"Fraction/10"
fractional formatting to the nearest tenth as words eg: Three and One Tenth
"DecimalWords/N"
the decimal number expressed in words, to N decimal places eg: Forty Six Point Eight Six
"0,0.00%"
the decimal number expressed in digits as a percentage (e.g. 1,003.05%)

General format

If the format text is not a pre-defined format, then it takes one of the general forms:
"prefix whole numberpart decimalpart suffix"
signed numbers
"prefix - whole numberpart decimalpart suffix"
signed numbers
"prefix + whole numberpart decimalpart suffix"
unsigned numbers
"prefix ( whole numberpart decimalpart ) suffix"
bracketed negatives
where the
prefix, suffix and decimalpart
are all optional, and where the
prefix
and
suffix
characters, if there are any, are static characters that will appear before and after the number.
Whole number part
The
whole numberpart
of a general format determines how digits to the left of the decimal point are represented, and is one of:
0,0
with thousand-point characters and with a leading 0 if the whole number part is zero
0
without thousand-point characters and with a leading 0 if the whole number part is zero
0,#
with thousand-point characters and without a leading 0 if the whole number part is zero
#
without thousand-point characters and without a leading 0 if the whole number part is zero
Decimal part
The
decimalpart
of a general format determines how digits to the right of the decimal point are represented.
The
decimalpart,
if it occurs, always begins with a
.
(period) character.
The remaining characters in a decimalpart represent how many decimal places occur and whether or not they are padded with trailing zeros. This consists of zero or more
0
characters followed by zero or more
#
characters. Each
0
character represents a compulsory decimal place and each
#
character represents an optional decimal place.
For example:
Decimal Part
Decimal Places
.0
exactly 1
.00
exactly 2
.#
at most 1
.##
at most 2
.0000##
between 4 and 6

Examples

In the
english_uk
locale, the expression:
Text(
value, format
)
evaluates to a text for the following values and formats:
Value
Format
Return
1003
"digits"
"1003"
1003.5
"digits"
"1003.5"
1003.005
"digits"
"1003.005"
1003
"thousands"
"1,003"
1003
"words"
"One Thousand and Three"
1003
"wth"
"One Thousand and Third"
1003
"nth"
"1003rd"
1003
"th"
"rd"
1003
"wordslow"
"1003"
3
"wordslow"
"Three"
1003
"wthlow"
"1003rd"
3
"wthlow"
"Third"
-1003
"currencydigits"
"£-1,003"
-1003.5
"currencydigits"
"£-1,003.50"
-1003
"currencywords"
"Minus One Thousand and Three Pounds"
-1003.5
"currencywords"
"Minus One Thousand and Three Pounds and Fifty Pence"
-1003
"£0"
"£-1003"
-1003.5
"£0"
"£-1003"
-1003
"£0.00p"
"£-1003.00p"
-1003.5
"£0.00p"
"£-1003.50p"
-1003
"£(0.00)p"
"£(1003.00)p"
-1003.5
"£(0.00)p"
"£(1003.50)p"
-1003
"0"
"-1003"
-1003
"0,0"
"-1,003"
-1003
"-0"
"-1003"
-1003
"-0,0"
"-1,003"
-1003
"+0"
"1003"
-1003
"+0,0"
"1,003"
-1003
"(0)"
"(1003)"
-1003
"(0,0)"
"(1,003)"
1003.0305
"0"
"1003"
1003.0305
"0"
"1003"
1003.0305
"0.0"
"1003.0"
1003.0305
"0.00"
"1003.03"
1003.0305
"0.000"
"1003.031"
1003.0305
"0.000"
"1003.031"
1003.0305
"0.0000"
"1003.0305"
1003.0305
"0.00000000"
"1003.03050000"
1003.0305
"0.#"
"1003"
1003.0305
"0.##"
"1003.03"
1003.0305
"0.###"
"1003.03"
1003.0305
"0.####"
"1003.0305"
1003.0305
"0.########"
"1003.0305"
1003.0305
"0.0#"
"1003.03"
1003.0305
"0.0##"
"1003.03"
1003.0305
"0.00#"
"1003.03"
1003.0305
"0.00##"
"1003.0305"
1003.0305
"0.000###"
"1003.0305"
0.0305
"0.0#"
"0.03"
0.0305
"#.0#"
".03"
1003.0305
"0,0.00%"
"1,003.03%"
1003.0305
"0,0.000%"
"1,003.031%"
0.5
"fraction/2/4/8"
"One Half"
0.66
"fractiondigits"
"5/8"
0.66
"fractiondigits/2/3/4"
"2/3"
46.86
"decimalwords/2"
"Forty Six Point Eight Six"