Contents
If necessary, you can easily add your own to the standard Excel number formats. To do this, select the cells to which you want to apply a custom format, right-click on them and select the command from the context menu Cell format (Format Cells) – tab Number (number), Further – All formats (Custom):
In the field that appears on the right A type: enter the mask of the format you want from the last column of this table:
How it works…
In fact, everything is very simple. As you may have noticed, Excel uses several special characters in format masks:
- 0 (zero) – one obligatory familiarity (digit), i.е. this place in the format mask will be filled with a digit from the number that the user enters into the cell. If there is no number for this familiarity, then zero will be displayed. For example, if the number 12 apply mask 0000, then it will work 0012, and if to the number 1,3456 apply mask 0,00 – it will turn out 1,35.
- # (grid) – one optional familiarity – about the same as zero, but if there is no number for the familiarity, then nothing is displayed
- (space) – is used as a separator of groups of three places between thousands, millions, billions, etc.
- [] — You can specify the font color in square brackets before the format mask. The following colors are allowed: black, white, red, blue, green, yellow, cyan.
Plus a couple of simple rules:
- Any custom text (kg, people, Pieces and the like) or characters (including spaces) must be enclosed in quotation marks.
- You can specify several (up to 4) different format masks separated by semicolons. Then the first of the masks will be applied to the cell if the number in it is positive, the second – if it is negative, the third – if the contents of the cell is zero, and the fourth – if the cell contains not a number, but text (see above example with temperature).
- How to hide cell content with custom format