Sub topic 11
Reading and Writing Custom Number Format Codes
Assume you can enter formulas, copy cells, and use relative and absolute references. You should also know basic financial terms such as revenue, EBITDA, and margin. This chapter focuses on how Excel changes a cell’s appearance without changing its stored value.
The four sections of a custom format
A custom number format is a pattern that controls how Excel displays a value. Sections are separated by semicolons:
positive;negative;zero;textExcel uses the first section for positive numbers, the second for negative numbers, the third for zero, and the fourth for text. If you omit sections, Excel reuses the available pattern according to its rules.
For example:
#,##0_);(#,##0);"-"_);@This format displays positive values with commas, negative values in parentheses, zero as a dash, and text unchanged.
Placeholders and literal characters
The 0 placeholder always shows a digit, including a zero. The # placeholder shows a digit only when needed. The ? placeholder reserves space for alignment.
0.00 8 displays as 8.00
#.## 8 displays as 8
#,##0 12345 displays as 12,345Put literal text inside quotation marks. For example, this format displays 8.25 as 8.3x:
0.0"x"A percent sign multiplies the displayed value by 100. Therefore, a stored value of 0.125 displays as 12.5% with this format:
0.0%The percent sign changes the display only. The stored value remains 0.125.
Financial formats and scaling
A common financial format shows negatives in parentheses and zero as a dash:
#,##0_);(#,##0);"-"_)Use a normal closing parenthesis in Excel:
#,##0_);(#,##0);"-"_ )The spacing characters _ and * control alignment and repetition. Because these codes can be difficult to read, test them on positive, negative, zero, and text values before applying them across a model.
A trailing comma scales the displayed value by 1,000. Two trailing commas scale it by 1,000,000:
#,##0.0,,_);(#,##0.0,,);"-"_)A stored value of 12,345,678 displays as 12.3. Add a visible unit when useful:
#,##0.0,,"m"This displays the same value as 12.3m.
Check formats
Custom formats can turn model checks into readable flags:
[Green]"OK";[Red]"ERROR";[Green]"OK"Use this only when the section logic matches the check’s meaning. A balance difference of zero may need a dedicated zero section, while a negative difference may indicate an error.
Exercise
A cell stores 0.0875. Which custom format displays it as 8.8%?
Show answer
Use 0.0%. Excel multiplies the stored value by 100 for display and shows one decimal place.