Excel Custom Number Format Color Codes and Examples

How-to basics · Updated November 19, 2026

In an Excel custom number format, add a color name in square brackets at the start of a section, such as [Red]#,##0 or [Blue]$#,##0.00. Excel recognizes eight named colors—Black, Blue, Cyan, Green, Magenta, Red, White, and Yellow—and indexed colors written as [Color1] through [Color56].

What a custom number format color code does

A color code in a custom number format changes the font color used to display a cell’s value. It does not change the stored value, the cell’s fill color, or the value used in calculations. For example, a cell containing the number 1250 can show as red text with a thousands separator while remaining the number 1250 for formulas, sorting, and charts.

These codes are useful when color is a small part of how a number should appear: showing negative amounts in red, distinguishing values by sign, or making a zero display as a dash in a chosen color. Because the color is part of the number format, it travels with that format when you copy the cell or apply the format elsewhere.

A custom format is a display rule, not a conditional-formatting rule. It generally assigns a color based on which section of the format applies, rather than evaluating a complex formula or looking at other cells. For more flexible rules—such as highlighting a whole row when a due date has passed—use conditional formatting instead.

Where to enter a color code in Excel

In Excel for Microsoft 365 on Windows, select the cells, press Ctrl+1, and open the Number tab. Choose Custom in the Category list, enter a format in the Type box, and select OK. You can also open the Format Cells dialog from Home > Number using the small dialog-box launcher. If you select a built-in format first, Excel may show its code as a starting point that you can edit.

On a Mac, select the cells and press Command+1 to open Format Cells; then choose Custom and edit the Type box. Excel for the web can handle many number formats, but available controls and custom-format editing can differ from the desktop app. If a particular format cannot be created or adjusted in the browser, open the workbook in desktop Excel.

Type the color tag in square brackets, followed by the number-format tokens. For instance, [Red]0.00 displays a value with two decimal places in red. The tag can be placed in the relevant section rather than being repeated for every digit or punctuation mark.

How sections control color

A custom number format can contain up to four semicolon-separated sections, in this order: positive numbers; negative numbers; zero; text. Each section can have its own color and display pattern. If a section is omitted, Excel applies its format rules to the remaining types as permitted by the format structure. The @ placeholder represents text in a fourth section.

  • [Blue]#,##0;[Red](#,##0);[Green]0;@ shows positive whole numbers in blue, negative whole numbers in red with parentheses, zeros in green, and text as entered.
  • [Red]$#,##0.00;[Blue]($#,##0.00);[Green]"-";@ displays positive currency in red, negative currency in blue inside parentheses, and zero as a green dash.
  • [Blue]0.0%;[Red](0.0%);0.0%;@ shows positive percentages in blue and negative percentages in red. Zero and text use the later sections’ formats.

In the second example, the quoted dash is literal text: it replaces the visible zero but does not turn the underlying zero into text. The format still leaves the value available for arithmetic. If you want a zero to appear as a blank, an empty section can be used, but be careful: a blank display can make real zeros easy to overlook.

Named colors and indexed colors

The eight named color tags are straightforward: [Black], [Blue], [Cyan], [Green], [Magenta], [Red], [White], and [Yellow]. Put the tag in brackets exactly as shown, then follow it with the number-format pattern. These names are convenient when a basic, recognizable color is enough.

For a broader set of choices, use an index tag such as [Color10] or [Color45]. The number must be from 1 through 56, with no space between Color and the number. These are indexed palette colors rather than arbitrary RGB or hexadecimal values. The exact appearance can depend on the workbook’s color palette and how it is interpreted by the version of Excel or another spreadsheet program. If a precise brand color matters, set the font color directly or use a different formatting approach, then check the workbook in the environments where it will be used.

A custom number format does not accept a CSS-style value such as #FF0000 as a color tag. Nor can you type an RGB triplet into the brackets. Use one of the supported names or indexed colors for a format code; use the Font Color control or conditional formatting when you need more color control.

Using colors with conditions

Format sections can include numeric conditions as well as color tags. Conditions are written in square brackets and can use comparison operators such as >, >=, <, <=, =, or <>. A format can use conditions in its first two sections; the remaining section handles values that do not meet those conditions. A condition decides which section applies, and a color tag in that section sets the displayed font color.

For example, [>=1000][Blue]#,##0;[<0][Red]#,##0;[Green]0;@ displays numbers of 1,000 or more in blue, negative numbers in red, and other numbers in green. Text is handled by the fourth section. This is different from simply assigning blue to all positive values: here the threshold is 1,000, and smaller nonnegative values fall through to the third section.

Keep conditional format codes readable. A format with several conditions, color tags, and special display tokens can be hard for another person to interpret. For rules based on dates, text, formulas, or other cells, conditional formatting usually makes the logic easier to inspect and maintain.

When to use a custom format instead of conditional formatting

Use a custom number format when color is tied to the value’s basic number category and you also want to control how that number is displayed. It is a good fit for a report where negatives should appear in red and parentheses, or where zero should appear as a dash. The display rule stays attached to the cell’s number format and can be copied as part of ordinary formatting.

Use conditional formatting when the rule is more expressive or needs to respond dynamically to a formula, a date, a threshold managed separately, or another cell. For example, a format code can color a negative number, but it cannot by itself shade a row because the status cell says “Late.” In Excel for Microsoft 365 on Windows, conditional-formatting controls are on Home > Conditional Formatting. On a Mac, the same feature is available from the Home tab, although the layout can vary by release.

There is also a practical visibility difference. A custom number format changes the font color, so a user who later changes the number format may remove that color. Conditional formatting is managed separately and can reapply its appearance when the rule remains true. Neither method changes the underlying value; both are visual formatting.

Common problems and how to fix them

  • The brackets or spelling are wrong. Use a supported name such as [Red], or an index such as [Color12]. A missing bracket or an unsupported color label may cause the entry to be rejected or interpreted differently than intended.
  • The color appears on every value. Check the semicolon-separated sections. A tag in a section applies to values handled by that section; if you use one section only, it may govern more values than you expected.
  • Another color rule overrides the result. Review conditional-formatting rules for the cells. They can affect how the cell appears, so a number-format color may not be the only visual rule to consider.
  • The index color looks different elsewhere. Indexed colors are not a promise of a particular RGB value across every workbook or application. Prefer one of the named colors for a simple standard choice, or use direct font-color formatting if exact color matching is important.
  • The value seems changed after formatting. A custom number format changes what is displayed, not the stored number. Select the cell and inspect the formula bar or use the value in a calculation to confirm that distinction.

It is also worth checking the result with representative positive, negative, zero, and text values. A format that looks correct in one sample cell may not have the intended number of sections for the rest of the column. Use a test copy or a few sample cells before applying a complex code to an important report.

Frequently Asked Questions

What is the Excel color code for red in a custom format?
Use [Red] in square brackets, such as [Red]#,##0. The code colors the displayed font; it does not set the cell’s fill.

Can I use a hex color like #FF0000?
No. Excel custom number formats use the supported color names or indexed tags such as [Color3], not hexadecimal or RGB values. Apply a font color directly if you need a precise custom shade.

How do I make negative numbers red?
In a two-section format, put the red tag in the negative section, after the semicolon. For example, #,##0;[Red](#,##0) displays negatives in red parentheses while positives use the first section.

Do custom number format colors change the actual cell value?
No. They only change its appearance. The value remains numeric or text as originally stored, so calculations continue to use the underlying value.

Can a custom number format use more than one color?
Yes. Different sections can use different colors, and a section can combine a condition with a color tag. A format code supports only a limited set of sections and conditions, so use conditional formatting for more complex rules.

Choosing a reliable format

For a simple report, start with a familiar color name and a clear number pattern. Decide separately how positive values, negatives, zeros, and text should look, then use semicolons to define those sections in order. If you need a threshold, add a condition only where it improves the rule’s clarity. Finally, test a few representative values and verify the displayed result against the underlying values.

For example, a compact accounting-style format might be #,##0;[Red](#,##0);"-";@. It leaves positive values in the current font color, shows negative values in red parentheses, renders zero as a dash, and leaves text visible. The pattern illustrates the central idea: number-format color codes are a focused way to control how values look, not a replacement for changing the data or building complex visual rules.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.