17.16.4.2 Numeric formatting
- numeric-formatting-switch= # switch-argument ;
A numeric-formatting-switch specifies the format of a numeric result. If the result of a field is not a number, this switch has no effect.
If no numeric-formatting-switch is present, a numeric result is formatted without leading spaces or trailing fractional zeros. If the result is negative, a leading minus sign is present. If the result is a whole number, no radix point is present.
A numeric switch-argument is made up of a series of picture items.
Numeric Formatting Picture Items
- Picture Item
Description
0
Specifies the requisite numeric positions to display in the result. If the result does not include a digit in that position, 0 is displayed. [Example: In a US-English context, =4+5 # 00.00 displays “09.00”. end example]
#
Specifies the requisite numeric positions to display in the result. If the result does not include a digit in that position, a space is displayed. Extra fractional digits are rounded off. [Example: =9+6 # $### displays “$ 15”. end example]
x
Drops digits to the left of the x placeholder. If the placeholder is to the right of the decimal point, the result is rounded to that place. [Example: In a US-English context, =111053+111439 # x## displays “492”, =1/8 # 0.00x displays “0.125”, and =3/4 # .x displays “.8”. end example]
.
Indicates the radix-point position. [Example: In a US-English context, =95.4 # $###.00 displays “$ 95.40. end example] The radix-point
Numeric Formatting Picture Items
character displayed is locale-specific.
,
Separates groups of three digits. [Example: In a US-English context, =2456800 # $#,###,### displays “2,456,800”. end example] The separator character displayed is locale-specific.
-
+
Other
character
'text'
`numbered-item`
-
positive-result ;
-
negative-result
-
positive-result ;
-
negative-result ;
-
zero-result
Prepends a minus sign to a negative result, or prepends a space if the result is positive or 0. [Example: =80-90 # -## displays “-10”, while =90-80 # - ## displays " 80”. end example]
Prepends a plus sign to a positive result, a minus sign to a negative result, or a space if the result is 0. [Example: =90-80 # +## displays “+10”, and =80- 90 # +## displays “-10”. end example]
Includes the specified character in the result at that position. [Example: =33 # ##% displays “33%”. end example]
Includes text in the result. [Example: In a US-English context, if Price is a bookmark for 26.5, =Price*15% # “##0.00 ‘is the sales tax’” displays “$ 3.98 is the sales tax”. end example]
Includes, in Arabic numerals, the number of the preceding item numbered as a caption or resulting from a SEQ field (17.16.5.56). numbered-item shall be the same name as identifier in that SEQ field. [Example: =SUM(A1:D4) # “##0.00 ‘is the total of Table’ table
” displays “456.34 is the total of Table 2”. end example]
Specifies different sets of picture items for positive and negative results. A zero value uses the positive picture. [Example: =Sales95 # $#,##0.00;- $#,##0.00 displays that bookmark’s positive values using $#,##0.00, and it’s negative values using -$#,##0.00. end example]
Specifies different sets of picture items for positive, negative, and zero results. [Example: =Sales95 # $#,##0.00;-$#,##0.00;$0 displays that bookmark’s positive values using $#,##0.00, it’s negative values using - $#,##0.00, and its zero values using $0. end example]
- general-formatting-switch= * switch-argument ;
A general-formatting-switch specifies a variety of formats for a numeric or text result. If the result type of a field does not correspond to the format specified, this switch has no effect.
A switch-argument is made up of a series of picture items.