Format Property - Number and Currency Data Types

Format Property — Number and Currency Data Types

See Also         Example         Applies To

You can set the Format property to predefined number formats or custom number formats for the Number and Currency data types.

Setting

Predefined Formats

The following table shows the predefined Format property settings for numbers.

Setting Description
General Number (Default) Display the number as entered.
Currency Use the thousand separator; follow the settings specified in Regional Settings in Windows Control Panel for negative amounts, decimal and currency symbols, and decimal places.
Euro Use the currency format, with the euro symbol (), regardless of the currency symbol specified in Regional Settings in Windows Control Panel.
Fixed Display at least one digit; follow the settings specified in Regional Settings in Windows Control Panel for negative amounts, decimal and currency symbols, and decimal places.
Standard Use the thousand separator; follow the settings specified in Regional Settings in Windows Control Panel for negative amounts, decimal symbols, and decimal places.
Percent Multiply the value by 100 and append a percent sign (%); follow the settings specified in Regional Settings in Windows Control Panel for negative amounts, decimal symbols, and decimal places.
Scientific Use standard scientific notation.

Custom Formats

Custom number formats can have one to four sections with semicolons (;) as the list separator. Each section contains the format specification for a different type of number.

Section Description
First The format for positive numbers.
Second The format for negative numbers.
Third The format for zero values.
Fourth The format for Null values.

For example, you could use the following custom Currency format:

$#,##0.00[Green];($#,##0.00)[Red];"Zero";"Null"

This number format contains four sections separated by semicolons and uses a different format for each section.

If you use multiple sections but don't specify a format for each section, entries for which there is no format either will display nothing or will default to the formatting of the first section.

You can create custom number formats by using the following symbols.

Symbol Description
. (period) Decimal separator. Separators are set by double-clicking Regional Settings in Windows Control Panel.
, (comma) Thousand separator.
0 Digit placeholder. Display a digit or 0.
# Digit placeholder. Display a digit or nothing.
$ Display the literal character "$".
% Percentage. The value is multiplied by 100 and a percent sign is appended.
E– or e– Scientific notation with a minus sign (–) next to negative exponents and nothing next to positive exponents. This symbol must be used with other symbols, as in 0.00E–00 or 0.00E00.
E+ or e+ Scientific notation with a minus sign next to negative exponents and a plus sign (+) next to positive exponents. This symbol must be used with other symbols, as in 0.00E+00.

Remarks

You can use the DecimalPlaces property to override the default number of decimal places for the predefined format specified for the Format property.

The predefined currency and euro formats follow the settings in Regional Settings in Windows Control Panel. You can override these by entering your own currency format.