Type 1500 into a cell, then look at what the sheet shows you: $1,500.00, 1,500, or plain 1500. The stored value never moved. Only the display did — and that gap between value and display is what a custom number format controls. Learn the syntax and you can turn a column of raw numbers into currency that reads clearly, dates in the shape your team expects, and negatives that flag themselves in red without a single conditional-formatting rule.
Excel ships with a handful of preset formats, but the built-in list runs out fast. Anything specific — a hyphen in place of zero, thousands rounded to 1.5K, a fiscal-year date — needs a custom code.
Where custom formats sit, and why they aren’t cosmetic
A custom number format is a display rule attached to a cell. It changes what you see; it never changes the underlying value. That single fact is worth internalizing before you type your first code, because it decides how the rest of the workbook behaves.
Type 1499.5 and apply $#,##0. The cell shows $1,500. A SUM on that column still adds 1499.5. A VLOOKUP matching $1,500 against that cell fails — the stored value is 1499.5, not the formatted string. Export to CSV and the raw number returns, symbol stripped.
=ROUND(A2,2) — the format alone will silently mislead totals that read the underlying value.
To open the dialog, select the cells, press Ctrl+1, and pick the Number tab, then Custom at the bottom. The Type box is where format codes live. Everything below is about what to type there.
The four sections every code can have
A full custom format has four sections separated by semicolons:
positive ; negative ; zero ; text
You do not have to write all four. One section applies to every value. Two sections mean the first handles zero-or-positive and the second handles negative. Three sections split positive, negative, and zero out. Four sections add a rule for text typed into the cell.
This tiny grammar is where most confusion comes from. Read the code left to right; count the semicolons; you know instantly which slot the rule is targeting.
| A | B | C | |
|---|---|---|---|
| 1 | Value | Format code | Displays as |
| 2 | 1500 | $#,##0.00 | $1,500.00 |
| 3 | -42 | 0;[Red](0) | (42) in red |
| 4 | 0 | #,##0;-#,##0;”—” | — |
| 5 | n/a | General;;;”[missing]” | [missing] |
The two placeholders that do the heavy lifting are 0 and #. A 0 forces a digit — 3.5 under 0.00 becomes 3.50. A # shows a digit only when one exists — the same value under #.## stays 3.5. Use 0 for columns that must line up decimally; use # when trailing zeros look like noise.
Currency codes that behave
The most common currency code is $#,##0.00: dollar sign glued to the number, comma thousands separator, always two decimals. Everything else is a variation on that theme.
$#,##0.00_);[Red]$(#,##0.00)
Reading that: positive values get a dollar sign, thousands separator, two decimals, then a trailing space the width of a closing parenthesis so the digits align with the negatives below. Negatives paint red and sit inside parens. This is what the built-in “Accounting” preset produces — you can build it yourself and drop the red if the workbook prints in monochrome.
_ followed by any character — reserves a space equal to that character’s width. Use _) in the positive section so positives indent by the width of the closing parenthesis in the negative section, and the decimal points line up down the column.
Foreign symbols work the same way; you just swap the character. Wrap anything that is not $ in double quotes so Excel treats it as literal text, not a code hint:
"€"#,##0.00
"£"#,##0.00
[$AUD] #,##0.00
The bracketed [$CODE] form is a locale-aware currency marker — the dialog inserts it when you pick a currency from its dropdown. It is the most portable way to write a currency code because it survives being opened on a machine with a different regional setting. For scaling large amounts, add trailing commas: $#,##0.0,,"M" shows $3.5M when the underlying value is 3500000. Each trailing comma divides the display by a thousand.
For a deeper reference on placeholder behavior and every special character Excel accepts, Microsoft’s guide to creating a custom number format is the primary source.
Date codes that don’t fight you
Dates in Excel are numbers under the hood — 2026-08-31 is really 46265, counted as days since 1900. Every date format is just a way to render that integer. The letters are the units:
| Code | What it shows | Example (for 2026-08-31) |
|---|---|---|
d / dd |
day, no zero / with leading zero | 31 / 31 |
ddd / dddd |
weekday short / full | Mon / Monday |
m / mm |
month number, no zero / padded | 8 / 08 |
mmm / mmmm |
month name short / full | Aug / August |
yy / yyyy |
2-digit / 4-digit year | 26 / 2026 |
Case matters less than position. Excel decides whether m means month or minute by what sits next to it — if it follows h or precedes s, it becomes minutes. Outside a time context, m is always month. That is why mm/dd/yyyy hh:mm works even though mm appears twice.
Common date codes that show up in practice:
m/d/yy
8/3/26 — three groups of digits, no country knows which is which.
d-mmm-yyyy
3-Aug-2026 — the month is a word, no reader misreads it.
For arithmetic on those underlying integers — subtracting one date from another, counting business days — the display code is irrelevant. If the calculation is what you need, our writeups on DATEDIF for age and tenure and WORKDAY and NETWORKDAYS cover the formulas that operate on the value itself.
Negative numbers: one decision, several tools
Financial reports treat negatives differently from operational dashboards. Decide once what the column means, then encode it in the format rather than sprinkling conditional formatting rules on top.
Three patterns cover almost every ask:
#,##0;-#,##0
#,##0;(#,##0)
#,##0;[Red]-#,##0
The first is the default minus sign, terse and neutral. The second is the accounting convention — negatives in parentheses, no sign — which reads well next to positive figures because the parens visually match column widths. The third paints negatives red and keeps the sign, which is what most managers actually mean when they say “flag the losses.”
Where custom formats really pull ahead of conditional formatting is when you want both — parens and color — plus a specific zero display:
[Red](#,##0), not (#,##0)[Red]. Excel supports eight named colors — Black, Blue, Cyan, Green, Magenta, Red, White, Yellow — plus [Color n] where n is a palette index from 1 to 56.
Conditional coloring inside the format code goes a step further with square-bracketed conditions:
[Blue][>=100]0;[Red][<0]0;0
Values 100 or greater paint blue; negatives paint red; everything else uses the default. This is genuinely faster than a conditional formatting rule when the threshold is a single number and the whole column shares it — no rule manager to open, no range to keep in sync.
When the format won’t stick
Three common failures. The fix for each is different, so identify which one you’re seeing before you start editing codes.
The cell shows the code instead of the formatted value. The cell is formatted as Text, not Number. Excel is showing you the code because it thinks you typed a string. Change the cell format to General, retype the value, then apply the custom format.
Dates render as five-digit numbers. The reverse of the above — the value was pasted from a source that Excel accepted as a plain number, so applying a date code just formats 46265. If the source shows 2026-08-31, wrap it in =DATEVALUE("2026-08-31"), or select the column and use Data → Text to Columns → Finish with a Date column type. The values become real dates and the format takes.
The format works but the totals feel wrong. This is the display/value trap: your format hides decimals and the totals include them. Either raise the format precision so the numbers reconcile visually, or apply =ROUND() so the stored value matches what the format shows.
- Confirm the cell is Number, not Text: Home → Number group → dropdown.
- Confirm the value is what you think it is: click the cell and read the formula bar, not the cell.
- Retype or repaste with the correct type, then apply the custom format last.
One last locale trap worth knowing: the format code uses semicolons to separate sections in English builds, but Excel installations set to certain European locales expect a different list separator character (often the comma). If a code that works in one file breaks in another, check File → Options → Advanced → Use system separators.
Where to start tomorrow
Pick the column in your workbook that gets the most looks — the totals row, the summary card, the one people screenshot into email. Give it a purpose-built format: $#,##0.00_);[Red]$(#,##0.00);"—" covers currency, red negatives, and blank zeros in one line. That single change makes the sheet read like something a person built, not a spreadsheet that dumped its default. Everything else — date columns, running totals, KPI counters — follows the same three-section pattern once you have it in muscle memory.
- ✓ Underlying values are numbers, not text
- ✓ Rounded with
ROUND()where totals depend on it, not just formatted - ✓ Dates written as
d-mmm-yyyyanywhere the file leaves your team - ✓ Negative and zero sections defined explicitly, not left to the default
