Each number that you would want to display may consist of several elements:
Digits that must be shown (e.g. zeros in a number with fixed decimal places);
Digits that need not be shown (thousands when the number is 500);
decimal points;
thousands indicators;
currency symbols;
percent symbols;
other symbols and number separators
The format descriptors for each of these is as follows:
0 numbers that must be shown
# numbers that do not need to be shown, but the digits must be represented in the format for other reasons
. where the decimal point appears
, thousands separator
% multiply by 100 and add a percent sign
E- scientific notation
"text" displays the text "text" in the cell
[colour] Puts the contents of the cell into colour colour.
So, for example, the following formats might be useful. The number entered into the cell is 16.475 in every case:
Format Display in the Cell Note 0.00 16.48 Rounds it up. #.## 16.475 0,000.00 0,016.48 0% 1648% Multiplied by 100 with % sign "Wrong Number" Wrong Number Just the text is displayed.In addition to these format definition codes, you can have different formats in the same cell depending on what the cell contains. The format code is split into four regions, each separated by a semicolon. The format up to the first semicolon if for positive numbers. The format up to the second semicolon is for negative numbers, the format up to the third semicolon is for zeros, and the format after the third semicolon is for text. So the following single format code can produce different results depending on the content of the cell:
[Blue] #,##0.00;[Red]-(#,##0.00);[Green]0.00;"Rubbish"
Content Display in Cell Colour of contents 12 12.00 Blue -12 -(12.00) Red 0 0.00 Green Any Text Rubbish Black