Excel Number Format Color Codes and Custom Formats

How-to basics · Updated November 19, 2026

Excel number format color codes add a color to displayed values through a custom number format: use bracketed names such as [Red], [Blue], or [Green]. Excel also supports indexed codes from [Color1] to [Color56]; these change how a value looks, not the value stored in the cell.

Which color codes Excel recognizes

The built-in named color codes are [Black], [Blue], [Cyan], [Green], [Magenta], [Red], [White], and [Yellow]. Put the code in square brackets within a custom number format. For example, [Red]0.00 displays a number with two decimal places in red.

For more choices, a custom format can use an indexed color code from [Color1] through [Color56]. These refer to colors in Excel’s indexed palette. They are not hexadecimal color values: a code such as [Color12] does not let you type an arbitrary RGB or web color. The appearance of indexed colors can depend on the workbook’s palette, so a named color is usually easier to understand and share.

These codes apply to the color of the formatted number or text, not the cell’s background. A number format cannot set a fill color. Use the Fill Color control or conditional formatting if the goal is to color the cell itself.

How color codes fit into a number format

A custom number format can contain up to four sections separated by semicolons. In the usual arrangement, they describe positive numbers, negative numbers, zero, and text, in that order. A color code placed in a section colors the values displayed by that section. For instance, the first section in a format with separate positive and negative sections can show positive values in green while the second shows negatives in red.

Here is a three-section example: [Green]#,##0.00;[Red](#,##0.00);[Black]0.00. Positive numbers appear in green with two decimal places and comma grouping; negative numbers appear in red inside parentheses; zero appears in black. The underlying number remains unchanged. The format only controls its presentation.

Sections can also contain number placeholders such as 0, #, and ?, date or time codes, percentage symbols, currency symbols, and literal text. The color code works alongside those instructions rather than replacing them. For example, [Blue]0% displays a value such as 0.25 as 25% in blue. It does not convert the stored value from 0.25 to 25.

How to enter a color-coded custom format

  1. Select the cells you want to format.
  2. On Windows, press Ctrl+1 to open Format Cells. On a Mac, press Command+1.
  3. Open the Number tab, select Custom in the Category list, and enter or edit the format in the Type box.
  4. Choose OK to apply the format. If you want to keep it for reuse in that workbook, the custom format remains available in its format list.

Before changing an existing format, read its semicolons and placeholders so you do not remove a section that controls negative values, zero, or text. You can also start with a built-in format and modify it in the Custom category. In Excel for the web, custom-format editing options can vary by build; if the Type box or the format you need is unavailable, open the workbook in the desktop app.

Useful examples for common number displays

These examples illustrate how colors combine with common formats. Enter the code in the Custom Type box; the bracketed color instruction is part of the code, not a separate Excel setting.

  • Color all values blue: [Blue]#,##0 displays whole numbers with thousands separators.
  • Separate positive and negative values: [Green]#,##0;[Red](#,##0) uses green for positive values and red parentheses for negative values. With two sections, zero follows the first section’s format.
  • Give zero its own appearance: [Green]#,##0;[Red](#,##0);[Black]- displays zero as a dash in black, while positive and negative numbers retain their separate styles.
  • Show percentages in color: [Magenta]0.0% displays a value such as 0.125 as 12.5% in magenta.
  • Color text in a fourth section: [Blue]#,##0;[Red](#,##0);[Black]0;[Cyan]@ formats positive numbers, negative numbers, zero, and text separately. The @ placeholder represents the cell’s text.

When a format has just one section, it generally applies that format to all numbers. With two or three sections, Excel assigns sections according to the positive, negative, and zero convention. The four-section form adds a text section. This is why adding a semicolon can change more than the color: it can change how whole categories of values are displayed.

Color names, indexed colors, and color limits

Named codes are usually the clearest choice in a workbook that will be shared. A reader can tell what [Red] means without looking up a palette number. Indexed codes are useful when a particular workbook’s palette is already established, but an index is not as self-explanatory and may not produce the same intended shade when a workbook’s palette differs.

Custom number formats do not offer the full color picker found in font formatting. You cannot insert a hex code such as #008000 into a number format and expect Excel to interpret it as a color. If you need a specific brand shade or an exact RGB color, use the Font Color control for a fixed appearance or conditional formatting for rules-driven appearance. In either case, the custom number format can still control decimals, symbols, and separators.

Number format colors versus conditional formatting

A color in a custom number format is a display rule attached to the number format. It is handy when the color should follow the format itself—for example, red for the negative section of an accounting-style display. Conditional formatting is a separate feature that can apply font color, fill, or other visual effects when specified cell values or formulas meet a rule.

Use a custom format when the appearance is simple and tied to the positive, negative, zero, or text sections. Choose conditional formatting when the rule is more flexible, such as highlighting dates before today, values above a threshold, or duplicates. To create a rule in Windows Excel, select the range and choose Home > Conditional Formatting, then pick a rule type. Conditional formatting can affect the final visible appearance, so check its rules if a custom-format color does not appear as expected.

Neither approach changes the actual value used by formulas. A red display does not make a number negative, and a green display does not confirm that data is correct. Color is a visual cue, not a calculation or validation rule.

Common problems and how to fix them

  • The code appears as text or does nothing: Open Format Cells and make sure the code is in the Custom Type box, with square brackets around the color name. Typing [Red]0 directly into a cell enters text rather than assigning a number format.
  • The color is not the one expected: Check whether the code is an indexed color and whether the workbook uses a customized palette. Try a named color to test whether the syntax is working.
  • Negative values do not get a separate color: Make sure the format has a second section after a semicolon. A one-section format does not define separate positive and negative displays.
  • Zeros look like positive values: Add a third section after another semicolon if zero needs a distinct display. Confirm that the section contains a valid zero format, such as 0 or a quoted dash.
  • A color rule seems overridden: Review conditional formatting on the cells and any other formatting applied to them. Also check that the selected range and the cell you are inspecting use the intended format.
  • Only part of a value seems colored: A number format affects the displayed cell contents, not surrounding cells or the fill. For a colored background, use a fill or conditional formatting rule.

One useful check is to select a cell and look at its formula bar and Format Cells dialog. The formula bar shows the stored value or entry, while the dialog shows the display format. A value of 0.5 displayed as 50% is normal percentage formatting, not a change to the stored value.

Choosing the right method

For a simple, fixed convention—such as green positives and red negatives—a custom number format is compact and travels with the cell’s number display. It can keep a worksheet readable without adding formulas or helper columns. Use named colors when possible, and test the result on positive, negative, zero, and text values if the format has multiple sections.

For exact shades, cell fills, or logic beyond basic number sections, use normal font formatting or conditional formatting. If a workbook needs to communicate meaning through color, do not rely on color alone: retain signs, labels, symbols, or another cue so the information remains understandable in grayscale and for readers with color-vision differences.

Frequently Asked Questions

What is the Excel color code for red in a number format?
Use [Red] in the custom format, as in [Red]0.00. The brackets are required, and the code belongs in the format rather than in the cell’s value.

Can I use a hex or RGB color code in a custom number format?
No. Excel’s custom number format color instructions use the named colors or indexed [Color1] through [Color56] codes. Use the font color picker or conditional formatting when you need a specific RGB shade.

Do Excel number format colors change the cell value?
No. They change how the value is displayed. For example, percentage formatting can display 0.25 as 25%, but formulas still use the stored value 0.25.

Can a custom number format color the cell background?
No. The color code affects the displayed cell contents, not the fill. Set a fill color separately or use conditional formatting if the background should depend on a rule.

Why does my custom color not show?
Check that the code is in the Custom format Type box and is enclosed in square brackets. Then review the cell’s conditional formatting and, for indexed codes, the workbook palette. A named color such as [Blue] is a good syntax check.

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.