Numeric Format Switch
- 2 minutes to read
Syntax
\# [ “ ] switch-argument [ “ ]
A numeric switch-argument is like a numeric format string. If a switch-argument contains spaces, enclose it in quotation marks.
If the result type of a field is not numeric, this switch has no effect.
Specifiers
You can combine the following specifiers to construct a format string.
Item | Usage |
---|---|
# | Specifies the numeric places to display in the result. If the result does not include a digit in that place, a space is displayed. |
0 (zero) | Specifies the numeric places to display in the result. If the result does not include a digit in that place, a 0 (zero) is displayed. |
. (decimal point) | Determines the decimal point position. The actual decimal symbol is dependent on the local Culture. You can specify it in the Regional settings (Control Panel). |
, (digit grouping symbol) | Separates a series of three digits. The actual symbol is dependent on the local Culture. You can specify it in the Regional settings (Control Panel). |
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 position. |
- (minus sign) | Adds a minus sign to a negative result, or adds a space if the result is positive or 0 (zero). |
+ (plus sign) | Adds a plus sign to a positive result, a minus sign to a negative result, or a space if the result is 0 (zero). |
other symbol(s) | Includes the specified character in the result. |
‘text’ | Adds text to the result. The text can contain any symbols, special symbols mentioned above are not interpreted. |
“positive; negative; zero” | You can use combinations for displaying positive, negative and zero values differently - just use a semicolon between switch arguments. For example, { MERGEFIELD Amount # $#,##0.00;-$#,##0.00;$0 } displays positive values using $#,##0.00, negative values using -$#,##0.00, and zero values using $0. |