Format Guide
A complete reference for Excel custom number format syntax — placeholders, colors, conditions, dates, and locale.
Excel number formats control how a value is displayed. They do not change the underlying value that Excel uses in formulas, sorting, filtering, or calculations.
That single idea explains most of the feature:
1234.567can display as1,234.57,1235,1.23E+03, or123456.7%- The same date can display as
2026-03-19,19 Mar 2026, orThursday - The same time can display as
16:36,4:36 PM, or40:36when shown as a duration
How to read a format string
A custom number format in Excel can contain up to four sections, separated by semicolons:
positive;negative;zero;textEach section controls how a specific type of value is displayed. When Excel formats a cell, it evaluates the underlying value and applies the first matching section. This means the same value can be displayed differently depending on how the format is structured, without changing the actual data stored in the cell.
You don’t have to define all four sections. Formats can include one, two, three, or four sections. If some sections are missing, Excel automatically falls back to default behavior. For example, with only one section defined, that format is used for all numeric values. With two sections, the first is used for positive and zero values, and the second for negative values.
The fourth section is optional and only applies to text values. To explicitly control how text is displayed, you typically include @, which acts as a placeholder for the original text. If no text section is defined, Excel will still display text normally using its default behavior.
The table below summarizes how Excel interprets the format string depending on how many sections are provided:
| Number of sections | Meaning |
|---|---|
1 section | Used for all numeric values (positive, negative, and zero) |
2 sections | First = positive and zero, second = negative |
3 sections | First = positive, second = negative, third = zero |
4 sections | First = positive, second = negative, third = zero, fourth = text |
Examples
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Two decimal places | 0.00 | 1234.57 | ||
Negative in parentheses | 0.00;(0.00) | (42.50) | ||
Zero as dash | 0.00;(0.00);"-" | - | ||
Text passthrough | 0.00;(0.00);"-";@ | 1234.57 |
Skipping a section
You can leave a section empty, but you must keep the semicolon. Each semicolon acts as a placeholder so Excel can correctly map values to their sections.
An empty section means: display nothing for that type of value. The underlying value is still stored in the cell—it’s just hidden.
Example: Positive values use 0.00, negative values are hidden, and zero displays as -:
0.00;;-Sections: positive → 0.00, negative → (empty), zero → -
You can also hide all values in a cell:
;;;All sections are empty, so nothing is displayed—numbers and text are both hidden.
Basic number formats
Excel's number formatting system is built on a small set of symbols that describe how a value should be displayed. These symbols are called placeholders, and they act as a visual template.
When Excel renders a cell, it takes the stored value and applies your format string to it. This process does not change the value itself — it only changes how the value appears to the user.
Digit placeholders
The most important elements in any format string are the digit placeholders. These define how numbers are structured, rounded, padded, or simplified.
| Token | Meaning |
|---|---|
0 | Required digit. Displays a digit or 0 if none exists. |
# | Optional digit. Displays digits only when present. |
? | Optional digit that reserves space for alignment. |
. | Decimal separator placeholder. The actual character displayed depends on your Excel language settings or the locale configured on your computer — for example, a comma (,) in many European locales. |
, | Thousands separator or scaling operator. The actual separator character used depends on your Excel language settings or system locale — for example, a period (.) in many European locales. When placed at the end of a number section (not between digits), it scales the value by 1,000 per comma. |
% | Multiplies the value by 100 and adds a percent sign. |
E+ / E- | Scientific notation. |
/ | Displays numbers as fractions when used in a fraction pattern. |
General | Uses Excel's default display rules. |
How Excel "fills" a format
A useful way to think about formats is that Excel reads your format string from left to right and fits the number into it. For example:
0.00- The integer part is placed before the decimal
- Exactly two digits are shown after the decimal
- Missing digits are filled with zeros
Whereas:
#.##- Only existing digits are shown
- No padding is added
- The result adapts to the value
The difference between 0, #, and ?
These three placeholders look similar but serve different purposes. Try typing the same value into both rows below:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
0.00 — fixed precision | 0.00 | 1.00 | ||
0.## — flexible precision | 0.## | 1. |
0 — enforce structure and precision
Use 0 when you need a fixed number of digits — especially in financial contexts where values must align and be directly comparable.
# — simplify and reduce visual noise
Use # when readability matters more than strict formatting — it removes unnecessary zeros and adapts dynamically to the value.
? — align values visually
? behaves like # but reserves a blank space where a hidden digit would have been. This keeps decimal points and fraction bars aligned in a column without adding visible zeros.
???.???Common patterns
These patterns are combinations of the basic placeholders and appear frequently in real-world usage. Rather than memorizing them, focus on understanding how they are constructed from the core tokens.
| Format | Meaning | Example |
|---|---|---|
0 | Whole numbers (rounded) | 12.7 → 13 |
0.00 | Fixed decimal precision | 12 → 12.00 |
#.## | Flexible decimal precision | 12 → 12, 12.3 → 12.3 |
00000 | Adds leading zeros to a fixed width | 42 → 00042 |
#,##0 | Thousands separator, no decimals | 12345 → 12,345 |
#,##0.00 | Thousands separator, two decimals | 12345.6 → 12,345.60 |
0% | Percentage (×100) | 0.126 → 13% |
0.00E+00 | Scientific notation | 12200000 → 1.22E+07 |
# ?/? | Fraction display | 5.25 → 5 1/4 |
General | Excel default display | Depends on value and column width |
Display vs. stored value
One of the most important concepts in Excel formatting is that rounding is often only visual. A cell containing 2.3456 formatted as 0.00 displays 2.35 — but the stored value is still 2.3456, and all calculations use the full precision.
ROUND() function rather than relying on formatting.Grouping and scaling large numbers
The comma , has two distinct behaviors depending on where it appears in the format string.
When placed inside the digit pattern it adds thousands separators. When placed after the last digit placeholder it scales the displayed value — each comma divides by 1,000.
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Thousands separator | #,##0 | 1,234,567 | ||
Scale to thousands (K) | 0.0,"K" | 12.0K | ||
Scale to millions (M) | 0.0,,"M" | 12.2M |
Percentages
The % symbol changes both meaning and scale. Excel assumes the stored value is already in decimal form — so 0.08 means 8%, and the format multiplies it by 100 before displaying.
Fractions
Fraction formats convert decimal numbers into fractional representations. The number of placeholders on each side of the slash controls how precise the fraction can be.
# ?/?
# ??/??
# ???/???| Input | Format | Display |
|---|---|---|
5.25 | # ?/? | 5 1/4 |
5.3 | # ??/?? | 5 3/10 |
Scientific notation
Scientific notation is used for very large or very small numbers. The format splits the value into a coefficient and an exponent.
0.00E+00
#0.0E+0| Input | Format | Display |
|---|---|---|
12200000 | 0.00E+00 | 1.22E+07 |
12200000 | #0.0E+0 | 12.2E+6 |
Special characters
So far, number formats have been about shaping numbers — deciding how many digits to show, where decimals go, and how values are grouped.
But in real-world usage, numbers rarely stand alone. You often need to add units, labels, symbols, or visual structure. This is where special characters come in.
Excel allows you to mix numeric placeholders with literal text and layout instructions. The key is understanding how Excel decides what is part of the format logic — and what should be displayed exactly as written.
Adding text to a number with quotes
The most common way to include text in a format is by using double quotes. Anything inside quotes is treated as literal text and displayed exactly as written — Excel does not try to interpret it.
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Suffix label | 0.0" kg" | 5.5 kg | ||
Prefix label | "Score: "0;"Score: "-0 | Score: 95 | ||
Units suffix | 0" units" | 3 units |
These formats don't change the number itself. They combine the numeric value with a label. This is especially useful for units, currencies, or simple annotations directly in the cell.
Showing characters that normally have meaning by escaping them
Some characters in Excel formats are not just text — they have special meaning. For example, % scales a number and # defines a digit placeholder.
If you want to display these characters literally, use a backslash \ to tell Excel not to interpret the next character.
| Input | Format | Display |
|---|---|---|
100 | \#0 | #100 |
100 | \%0 | %100 |
Working with text values (@)
Number formats don't only apply to numbers — they can also define how text values are displayed. The @ symbol is a placeholder that means: insert the original text here.
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Text prefix | 0.00;-0.00;0.00;"Text: "@ | Text: Sample |
If a user enters Sample, the cell displays Text: Sample. The @ acts as a bridge between the raw input and your format.
@, the text will not appear — Excel has no instruction to display it. If you don't define a text section at all, Excel falls back to its default and shows the text normally.The underscore _
The underscore inserts a blank space equal to the width of the next character. This solves a real alignment problem: negative numbers shown in parentheses like (123) take more horizontal space than 123. Without adjustment, columns look misaligned.
By adding _( and _), Excel reserves space for the parentheses on positive rows — even when they're not shown. Both rows below use the same format code, which is what makes the columns line up:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Negative (parentheses) | _(0_);(0);_(0_);_(@_) | (1234) | ||
Positive — with alignment | _(0_);(0);_(0_);_(@_) | 1234 | ||
Positive — no alignment | 0;(0) | 1234 |
Notice how the last row — without alignment — sits visually to the left compared to the rows above it. The number occupies less space than its parenthesised counterpart, so in a real column of mixed positive and negative values it would appear indented and out of step. The underscore closes that gap invisibly.
The asterisk *
The asterisk repeats a character to fill the remaining width of the cell. Instead of inserting a fixed number of characters, Excel dynamically fills the available space.
A common use is pushing the minus sign to the left edge of the cell, with the number remaining right-aligned — a layout pattern common in financial statements:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Minus aligned left | * 0;-* 0 | - 42 |
Understanding literal characters
At this point, it helps to think of every character in a format as belonging to one of three groups:
- Formatting instructions — define how numbers behave (
0,#,%,*,_,@, etc.) - Quoted text — always displayed exactly as written (
"kg","Total: ") - Escaped characters — forced to display literally using
\(e.g.\#,\%,\:)
Special case: : and /
The characters : and / are commonly used in time and date formats as separators. Outside of those contexts, they can behave inconsistently. If you want to be explicit — or avoid edge cases — it's safer to escape them:
\:
\/: and / normally when they act as time or date separators. Use \: and \/ when you need them as literal characters.Colors
You can set the text color for any section by placing a color code in square brackets at the very start of that section. The color only applies to the value displayed by that section — it does not affect the cell background or other cells.
[Red]0.00
[Blue]#,##0.00;[Red](#,##0.00)Named colors (Color 1–8)
Excel defines eight colors that can be referenced by name. These are the only colors with standard names — everything else must use an index number.
| Color | Name syntax | Index syntax | Hex |
|---|---|---|---|
| Black | [Black] | [Color 1] | #000000 |
| White | [White] | [Color 2] | #FFFFFF |
| Red | [Red] | [Color 3] | #FF0000 |
| Green | [Green] | [Color 4] | #00FF00 |
| Blue | [Blue] | [Color 5] | #0000FF |
| Yellow | [Yellow] | [Color 6] | #FFFF00 |
| Magenta | [Magenta] | [Color 7] | #FF00FF |
| Cyan | [Cyan] | [Color 8] | #00FFFF |
[Red] and [Color 3] produce exactly the same result. Use whichever is more readable.Indexed colors (Color 9–56)
Beyond the eight named colors, Excel supports 48 additional indexed colors — for a total palette of 56. These can only be referenced by their index number using [Color N] syntax.
[Color 9]0.00 → Dark Red
[Color 44]0.00 → Gold
[Color 46]0.00 → OrangeA sample of the indexed range:
| Color | Name | Syntax |
|---|---|---|
| #800000 | Dark Red | [Color 9] |
| #008000 | Dark Green | [Color 10] |
| #000080 | Dark Blue | [Color 11] |
| #C0C0C0 | Light Gray | [Color 15] |
| #FFCC00 | Gold | [Color 44] |
| #FF6600 | Orange | [Color 46] |
| #003366 | Dark Teal | [Color 49] |
| #333333 | Gray 80% | [Color 56] |
The full palette runs from Color 1 to Color 56. The format builder lists all available colors when you open the color picker.
Examples
Type a value into the input to see the color applied in the output column:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Red — named color | [Red]0.00 | 1234.56 | ||
Blue positive, Red negative | [Blue]0.00;[Red]-0.00 | 1234.56 | ||
Dark Red — indexed color (Color 9) | [Color 9]0.00 | 1234.56 | ||
Blue positive, Red parentheses, dash zero | [Blue]#,##0.00;[Red](#,##0.00);[Blue]"-" | 1,234.56 | ||
Blue text section | 0;-0;0;[Blue]@ | Sample |
How color inheritance works
When a section is not explicitly defined, Excel does not simply leave it colorless — it follows a set of inheritance rules:
- Negative and zero sections inherit the color of the positive section when they are not separately defined. If you write
[Red]0.00with only one section, negative and zero values will also display in red. - The text section always falls back to the application's default text color — it does not inherit the positive color. To color text values you must define the fourth section explicitly, e.g.
0;0;0;[Blue]@.
[Green]0.00 will turn all numeric output green — including negatives and zeros — unless you add additional sections to override them.The color code must come first
The color bracket must be the first element in its section — before any digit placeholders, prefixes, or other tokens.
Correct
[Red]0.00Will not work
0.00[Red]Conditions
Conditions allow you to make a format dynamic — instead of always applying the same pattern, Excel can choose a format based on the value in the cell.
This means you can change how numbers look depending on rules like:
- how large or small a value is
- whether it matches a specific number exactly
- whether it falls inside or outside a defined range
Unlike Conditional Formatting, this logic lives inside the number format string itself — no extra rules to manage, no separate panel to open. The condition travels with the format wherever it goes.
How conditions work
A condition is written inside square brackets. When a section also has a color, the color comes first, followed by the condition, then the format pattern:
[Color][condition]format
[Red][<10]0.00Without a color, the condition alone starts the section. You can use any of the standard comparison operators:
[<10]
[>=100]
[=1]
[<>0]| Operator | Meaning | Example |
|---|---|---|
< | Less than | [<100] |
<= | Less than or equal to | [<=100] |
> | Greater than | [>0] |
>= | Greater than or equal to | [>=10] |
= | Equal to | [=1] |
<> | Not equal to | [<>0] |
Each condition acts as a filter: "use this section only if the value satisfies this rule." Excel evaluates sections from left to right and applies the first one whose condition matches.
Section structure with conditions
Conditions can only be placed in the first and second sections. This gives you a structure with a built-in fallback:
[condition1]format1;[condition2]format2;fallback- First section — used when condition 1 matches
- Second section — used when condition 2 matches
- Third section — fallback if neither condition matches (this is no longer a "zero section" — it is a general catch-all)
- Fourth section — text values, same as always (optional)
Examples
Values up to 100 in red, values above 100 in blue:
[Red][<=100]0;[Blue][>100]0Below 10 with two decimals in red, 10 and above in green:
[Red][<10]0.00;[Green][>=10]0.00Singular and plural label — a common trick for unit formatting:
[=1]0" item";0" items"Three-tier threshold with a fallback:
[Red][<10]"Low";[Green][>=10]"High";"Other"Values below 10 → Low, values 10 and above → High, anything else (e.g. text or unmatched values) → Other.
What happens to negative numbers
This is one of the most important things to understand about conditional formats: when using conditions, Excel no longer treats negative numbers as a special category. Negative values are simply evaluated against your conditions like any other number.
[<100]0;[>=100]0.00For this format, -50 matches [<100] and is displayed as -50 — with a minus sign added automatically by Excel, using the first section's pattern.
If no condition matches the value, Excel falls back to the third section (if defined), or applies a default display.
Why custom negative formatting may not work
In a standard two-section format, the second section is dedicated to negative numbers and you can apply styling like parentheses:
0;(0) → -5 displays as (5)But in a conditional format, there is no dedicated negative section:
[<100]0;[>=100]0.00Here, Excel does not apply custom negative styling. It simply prepends a minus sign where needed. If you need special formatting for negative numbers — parentheses, color, or a different pattern — you must handle it explicitly in your conditions:
[Red][<0](0.00);[=0]"-";0.00Values below 0 → red parentheses, zero → dash, anything else → standard two-decimal display.
Text behavior
Conditions only apply to numeric values. Text entered into a cell is never evaluated against a numeric condition.
- If a fourth section is defined, it is used for text — exactly as in a standard format
- If no fourth section exists, Excel displays text values using its default behavior, regardless of any conditions in the format
When to use conditions
Custom number format conditions work best for lightweight, display-only rules that travel with the format:
- Changing text labels based on value (singular vs. plural, Low / High)
- Applying color changes at simple thresholds
- Defining a fallback display for edge cases
- Keeping formatting logic self-contained in the format string
When to use Conditional Formatting instead
Number format conditions are intentionally limited — they only control how a value is displayed as text. For anything more complex, Excel's dedicated Conditional Formatting feature is the right tool:
| Need | Use |
|---|---|
| Change text color or labels at a threshold | Number format condition |
| Fill color, icons, data bars, or color scales | Conditional Formatting |
| More than two conditions or complex logic | Conditional Formatting |
| Rules based on other cells or formulas | Conditional Formatting |
| Formatting that must survive copy-paste | Number format condition |
Date, time & duration
Excel does not actually store dates and times as separate types. Instead, everything is stored as a number, and formatting decides how that number is interpreted and displayed.
- A date is a whole number — the count of days since Excel's starting point
- A time is a decimal fraction of a day
- A date + time is a single number combining both: integer part for the date, fractional part for the time
| Value | Meaning |
|---|---|
1 | One full day (Jan 1, 1900 in Excel's calendar) |
0.5 | Half a day → 12:00 noon |
46100 | A specific calendar date (March 19, 2026) |
46100.6917 | Same date with a time component (~16:36) |
How date and time formats are built
A date or time format is assembled by combining tokens. Each token extracts a specific component — year, month, day, hour, minute — from the underlying number and places it in the output.
You can think of the process as:
- Excel reads the serial number
- It splits it into components (year, month, day, hour, minute, second)
- It inserts those components into your format string in the positions you defined
yyyy-mm-dd
↓
2026-03-19The - characters are just literal separators between the tokens. Everything else is a token that extracts part of the date.
Date tokens
Date tokens extract parts of the calendar date from the serial number:
| Token | Meaning | Example |
|---|---|---|
d | Day without leading zero | 19 |
dd | Day with leading zero | 03 for the 3rd |
ddd | Abbreviated weekday name | Thu |
dddd | Full weekday name | Thursday |
m | Month without leading zero | 3 |
mm | Month with leading zero | 03 |
mmm | Abbreviated month name | Mar |
mmmm | Full month name | March |
mmmmm | First letter of month only | M |
yy | Two-digit year | 26 |
yyyy | Four-digit year | 2026 |
Tokens combine by being placed in sequence, with any punctuation or spaces as separators. The order you write them is the order they appear in the output — you are not choosing a preset format, you are building one from components:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
ISO date | yyyy-mm-dd | 2026-03-19 | ||
Day / Month / Year | dd/mm/yyyy | 19/03/2026 | ||
Day — abbreviated month — Year | d-mmm-yyyy | 19-Mar-2026 | ||
Full month name and year | mmmm yyyy | March 2026 | ||
Weekday name only | dddd | Thursday |
Time tokens
Time tokens extract the time portion — the fractional part of the serial number. They work on the same principle as date tokens: combine them in order, separated by literal characters like :.
| Token | Meaning |
|---|---|
h | Hour without leading zero |
hh | Hour with leading zero |
m | Minute without leading zero (after h or before s) |
mm | Minute with leading zero (after h or before s) |
s | Second without leading zero |
ss | Second with leading zero |
AM/PM, am/pm, A/P | Switches to 12-hour clock and appends the period marker |
ss.00 | Seconds with hundredths of a second |
The examples below all use 0.6917 as the input — a fraction representing approximately 16:36 of a day. Try your own decimal values to explore how the time output changes:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
24-hour clock | h:mm | 16:36 | ||
24-hour clock with seconds | hh:mm:ss | 16:36:03 | ||
12-hour clock with AM/PM | h:mm AM/PM | 4:36 PM | ||
Fractional seconds | h:mm:ss.00 | 16:36:02.88 |
Duration and elapsed time
Standard time formats behave like a clock — they reset after 24 hours. A value of 1.125 (27 hours) formatted as hh:mm would display as 03:00 because the display wraps around midnight.
To display true elapsed time without wrapping, wrap the leading token in square brackets:
| Format | Meaning |
|---|---|
[h]:mm | Total elapsed hours — does not reset at 24 |
[mm]:ss | Total elapsed minutes — does not reset at 60 |
[ss].00 | Total elapsed seconds with hundredths |
The default input below is 1.125, which equals exactly 27 hours. Compare what [h]:mm and [mm]:ss show versus a non-bracketed format:
| Name | Format Code | Input | Output | Actions |
|---|---|---|---|---|
Elapsed hours and minutes | [h]:mm | 27:00 | ||
Elapsed minutes and seconds | [mm]:ss | 28:48 |
The month vs. minute ambiguity
Whether the month and minute tokens share the same letter depends on your language setting. In English — and several other languages — month and minute both use m and mm, which creates an ambiguity. In other languages, such as German, month uses uppercase M / MM while minute keeps lowercase m / mm, so no ambiguity exists.
Where the ambiguity does exist, Excel resolves which meaning applies based purely on position:
- After
horhh→ interpreted as minutes - Before
sorss→ interpreted as minutes - In any other position → interpreted as month
| Format | What the token means | Example output (English) |
|---|---|---|
mm/dd/yyyy | Month (no adjacent hour or second) | 03/19/2026 |
h:mm | Minute (follows h) | 16:36 |
h:mm:ss | Minute (follows h and precedes ss) | 16:36:03 |
mm:ss | Minute (precedes ss) | 36:03 |
h or s will change how Excel interprets it.Mixing date and time
Because date and time come from the same number — the integer part for the date, the fractional part for the time — you can mix date and time tokens freely in a single format string. The examples below use 46100.6917 as the input (March 19, 2026 at approximately 16:36):