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.567 can display as 1,234.57, 1235, 1.23E+03, or 123456.7%
  • The same date can display as 2026-03-19, 19 Mar 2026, or Thursday
  • The same time can display as 16:36, 4:36 PM, or 40:36 when shown as a duration
Formats are sensitive to language and regional settings. Your current settings: English (United States), Excel.

How to read a format string

A custom number format in Excel can contain up to four sections, separated by semicolons:

positive;negative;zero;text

Each 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 sectionsMeaning
1 sectionUsed for all numeric values (positive, negative, and zero)
2 sectionsFirst = positive and zero, second = negative
3 sectionsFirst = positive, second = negative, third = zero
4 sectionsFirst = positive, second = negative, third = zero, fourth = text

Examples

NameFormat CodeInputOutputActions
Two decimal places
0.00
1234.57
Edit
Negative in parentheses
0.00;(0.00)
(42.50)
Edit
Zero as dash
0.00;(0.00);"-"
-
Edit
Text passthrough
0.00;(0.00);"-";@
1234.57
Edit

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.

TokenMeaning
0Required 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.
GeneralUses 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:

NameFormat CodeInputOutputActions
0.00 — fixed precision
0.00
1.00
Edit
0.## — flexible precision
0.##
1.
Edit

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.

FormatMeaningExample
0Whole numbers (rounded)12.7 → 13
0.00Fixed decimal precision12 → 12.00
#.##Flexible decimal precision12 → 12, 12.3 → 12.3
00000Adds leading zeros to a fixed width42 → 00042
#,##0Thousands separator, no decimals12345 → 12,345
#,##0.00Thousands separator, two decimals12345.6 → 12,345.60
0%Percentage (×100)0.126 → 13%
0.00E+00Scientific notation12200000 → 1.22E+07
# ?/?Fraction display5.25 → 5 1/4
GeneralExcel default displayDepends 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.

This can lead to confusion when users assume the displayed value is the actual value. If you need calculations to use rounded values, use the 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.

NameFormat CodeInputOutputActions
Thousands separator
#,##0
1,234,567
Edit
Scale to thousands (K)
0.0,"K"
12.0K
Edit
Scale to millions (M)
0.0,,"M"
12.2M
Edit

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.

NameFormat CodeInputOutputActions
Whole percent
0%
8%
Edit
One decimal percent
0.0%
8.3%
Edit

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.

# ?/?
# ??/??
# ???/???
InputFormatDisplay
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
InputFormatDisplay
122000000.00E+001.22E+07
12200000#0.0E+012.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.

NameFormat CodeInputOutputActions
Suffix label
0.0" kg"
5.5 kg
Edit
Prefix label
"Score: "0;"Score: "-0
Score: 95
Edit
Units suffix
0" units"
3 units
Edit

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.

InputFormatDisplay
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.

NameFormat CodeInputOutputActions
Text prefix
0.00;-0.00;0.00;"Text: "@
Text: Sample
Edit

If a user enters Sample, the cell displays Text: Sample. The @ acts as a bridge between the raw input and your format.

If you include a text section but forget @, 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:

NameFormat CodeInputOutputActions
Negative (parentheses)
_(0_);(0);_(0_);_(@_)
(1234)
Edit
Positive — with alignment
_(0_);(0);_(0_);_(@_)
1234
Edit
Positive — no alignment
0;(0)
1234
Edit

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:

NameFormat CodeInputOutputActions
Minus aligned left
* 0;-* 0
- 42
Edit

Understanding literal characters

At this point, it helps to think of every character in a format as belonging to one of three groups:

  1. Formatting instructions — define how numbers behave (0, #, %, *, _, @, etc.)
  2. Quoted text — always displayed exactly as written ("kg", "Total: ")
  3. Escaped characters — forced to display literally using \ (e.g. \#, \%, \:)
When something doesn't behave as expected, it's usually because Excel is interpreting a character as a formatting instruction instead of text. If in doubt, make it explicit — either quote it or escape it.

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:

\:
\/
Use : 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.

ColorName syntaxIndex syntaxHex
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
For colors 1–8, both syntaxes are equivalent. [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   → Orange

A sample of the indexed range:

ColorNameSyntax
#800000Dark Red[Color 9]
#008000Dark Green[Color 10]
#000080Dark Blue[Color 11]
#C0C0C0Light Gray[Color 15]
#FFCC00Gold[Color 44]
#FF6600Orange[Color 46]
#003366Dark Teal[Color 49]
#333333Gray 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:

NameFormat CodeInputOutputActions
Red — named color
[Red]0.00
1234.56
Edit
Blue positive, Red negative
[Blue]0.00;[Red]-0.00
1234.56
Edit
Dark Red — indexed color (Color 9)
[Color 9]0.00
1234.56
Edit
Blue positive, Red parentheses, dash zero
[Blue]#,##0.00;[Red](#,##0.00);[Blue]"-"
1,234.56
Edit
Blue text section
0;-0;0;[Blue]@
Sample
Edit

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.00 with 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]@.
This means a single-section color like [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.00

Will not work

0.00[Red]
Colors in number formats only change the text color of the displayed value. They cannot set background fills, add icons, or apply data bars. For those, use Conditional Formatting instead.

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.00

Without a color, the condition alone starts the section. You can use any of the standard comparison operators:

[<10]
[>=100]
[=1]
[<>0]
OperatorMeaningExample
<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)
As soon as you use a condition in any section, Excel stops treating sections as positive / negative / zero / text. The default section meaning is replaced entirely by your conditions and the fallback.

Examples

Values up to 100 in red, values above 100 in blue:

[Red][<=100]0;[Blue][>100]0

Below 10 with two decimals in red, 10 and above in green:

[Red][<10]0.00;[Green][>=10]0.00

Singular 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.00

For 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.00

Here, 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.00

Values 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:

NeedUse
Change text color or labels at a thresholdNumber format condition
Fill color, icons, data bars, or color scalesConditional Formatting
More than two conditions or complex logicConditional Formatting
Rules based on other cells or formulasConditional Formatting
Formatting that must survive copy-pasteNumber format condition
A useful rule of thumb: if you only need to change what the number looks like as text — including its color — a format condition is simpler and more portable. If you need anything visual beyond that, use Conditional Formatting.

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
ValueMeaning
1One full day (Jan 1, 1900 in Excel's calendar)
0.5Half a day → 12:00 noon
46100A specific calendar date (March 19, 2026)
46100.6917Same date with a time component (~16:36)
Date and time formats are simply different ways of interpreting parts of the same underlying number. The value never changes — only the display does.

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:

  1. Excel reads the serial number
  2. It splits it into components (year, month, day, hour, minute, second)
  3. It inserts those components into your format string in the positions you defined
yyyy-mm-dd
↓
2026-03-19

The - 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:

TokenMeaningExample
dDay without leading zero19
ddDay with leading zero03 for the 3rd
dddAbbreviated weekday nameThu
ddddFull weekday nameThursday
mMonth without leading zero3
mmMonth with leading zero03
mmmAbbreviated month nameMar
mmmmFull month nameMarch
mmmmmFirst letter of month onlyM
yyTwo-digit year26
yyyyFour-digit year2026

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:

NameFormat CodeInputOutputActions
ISO date
yyyy-mm-dd
2026-03-19
Edit
Day / Month / Year
dd/mm/yyyy
19/03/2026
Edit
Day — abbreviated month — Year
d-mmm-yyyy
19-Mar-2026
Edit
Full month name and year
mmmm yyyy
March 2026
Edit
Weekday name only
dddd
Thursday
Edit

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 :.

TokenMeaning
hHour without leading zero
hhHour with leading zero
mMinute without leading zero (after h or before s)
mmMinute with leading zero (after h or before s)
sSecond without leading zero
ssSecond with leading zero
AM/PM, am/pm, A/PSwitches to 12-hour clock and appends the period marker
ss.00Seconds 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:

NameFormat CodeInputOutputActions
24-hour clock
h:mm
16:36
Edit
24-hour clock with seconds
hh:mm:ss
16:36:03
Edit
12-hour clock with AM/PM
h:mm AM/PM
4:36 PM
Edit
Fractional seconds
h:mm:ss.00
16:36:02.88
Edit

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:

FormatMeaning
[h]:mmTotal elapsed hours — does not reset at 24
[mm]:ssTotal elapsed minutes — does not reset at 60
[ss].00Total 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:

NameFormat CodeInputOutputActions
Elapsed hours and minutes
[h]:mm
27:00
Edit
Elapsed minutes and seconds
[mm]:ss
28:48
Edit
Use bracketed formats when measuring elapsed time (durations, stopwatches, time logs). Use plain formats when displaying a clock time (time of day).

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 h or hh → interpreted as minutes
  • Before s or ss → interpreted as minutes
  • In any other position → interpreted as month
FormatWhat the token meansExample output (English)
mm/dd/yyyyMonth (no adjacent hour or second)03/19/2026
h:mmMinute (follows h)16:36
h:mm:ssMinute (follows h and precedes ss)16:36:03
mm:ssMinute (precedes ss)36:03
The token letters in the table above reflect your current language setting. The example outputs use English — month and day names will appear in your Excel UI language.
If a format produces unexpected output, check whether your month token is being read as minutes — or vice versa. Moving the token adjacent to a 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):

NameFormat CodeInputOutputActions
Date and time combined
yyyy-mm-dd hh:mm
2026-03-19 16:36
Edit
Date and 12-hour time
dd mmm yyyy h:mm AM/PM
19 Mar 2026 4:36 PM
Edit