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.

Quotation marks are required around switch-argument if it contains white space; otherwise, they are optional.

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".

#

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".

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".

.

Indicates the radix-point position.
example: : In a US-English context, =95.4 \# $###.00 displays "$ 95.40.
The radix-point character displayed is locale-specific.

,

Separates groups of three digits.
example: : In a US-English context, =2456800 \# $#,###,### displays "2,456,800".
The separator character displayed is locale-specific.

-

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".

+

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".

Other character

Includes the specified character in the result at that position.
example: : =33 \# ##% displays "33%".

'text'

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".

`numbered-item`

Includes, in Arabic numerals, the number of the preceding item numbered as a caption or resulting from a SEQ field (§2.16.5.63). 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".

positive-result ; negative-result

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.

positive-result ; negative-result ; zero-result

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.