To give a cell a specific color code in Excel for Microsoft 365 on Windows, select the cell or range, open Home > Fill Color ▼ > More Colors, then enter the color’s RGB values—or its hex value if your color picker provides a hex field. Use Font Color instead to color text. You can also color-code data with conditional formatting so colors change automatically when values meet a rule.
What You’ll Need
- An Excel workbook and the cells you want to format.
- The color’s RGB values, such as 31, 78, 120, or a hex code, such as #1F4E78. If you only have a hex code and the picker does not accept it, convert it to RGB first.
- For automatic color coding, a clear condition to use, such as “highlight values below 0” or “mark overdue dates.”
You do not need a plug-in or a formula to apply a color manually. Excel’s color picker may look slightly different depending on the update and whether you use the desktop app or Excel for the web. If you do not see a hex field, the RGB method works for custom colors.
Step-by-Step
- Select the cells you want to color. Click one cell to format it, or drag across a range to format several cells at once. To select a whole column, click its letter; to select a whole row, click its number. If you are applying different colors to different categories, select and format each category separately. Starting with the right selection helps prevent accidentally changing unrelated cells.
- Open the fill color options. On the ribbon, choose Home. In the Font group, click the arrow next to the paint-bucket-shaped Fill Color button. The main part of the button applies the last-used fill color; the arrow opens the palette. Select a standard or theme color if an exact brand or report color is not required.
- Open the custom color picker. In the palette, choose More Colors. In the dialog, open the Custom tab if it is not already selected. The Windows desktop dialog commonly provides fields for Red, Green, and Blue, with values from 0 to 255. Some Microsoft 365 color pickers also show a hex field. The precise layout can vary by update.
- Enter the color code. If a hex field is available, type the six-digit code there; follow the dialog’s format, since some fields accept a leading # and others do not. If the dialog only has RGB fields, enter the three decimal values in Red, Green, and Blue order. For example, #1F4E78 is RGB 31, 78, 120: 1F converts to 31, 4E to 78, and 78 to 120. Check the preview, then click OK to apply the fill.
- Apply a separate color to text, if needed. Select the cells again, choose the arrow beside Font Color on the Home tab, and use More Colors to enter the same or another custom code. Fill color changes the cell background; font color changes the characters. For readable results, use enough contrast between the text and its background, especially for small labels and numbers.
- Check the result in the worksheet. Confirm that the intended cells changed and that the text is still easy to read. If the color looks different from your reference, compare the RGB values digit by digit and check whether you entered them in the correct order. A code is not interchangeable with a theme color that only looks similar; use the custom picker when exact consistency matters.
- Reuse a color in the same workbook. Once applied, the color is often available among recent colors in the palette. Select another range and choose that swatch. You can also copy formatting from a correctly colored cell: select it, choose Home > Format Painter, then select the destination cells. Format Painter can copy more than color, including number formats and borders, so inspect the destination afterward if you only wanted the fill.
- Set up automatic color coding when values should control the color. Select the data range, then choose Home > Conditional Formatting. For a straightforward threshold, select Highlight Cells Rules and choose a rule such as Less Than, enter the threshold, and select a preset style. For a custom color, choose New Rule, select the rule type that matches your data, and set the format through the rule’s formatting controls. Click OK to save the rule. The color will update when the cell values change.
- Review and manage conditional formatting rules. With a cell in the formatted range selected, open Home > Conditional Formatting > Manage Rules. Check that the rule applies to the intended range and that its condition is right. When multiple rules overlap, their order and settings can affect what appears. Edit or remove rules that are no longer needed rather than layering new ones over old formatting.
Mac and web note: Excel for Mac has the same general route through the Home tab and color menus, although the custom-color dialog may present RGB controls differently. Excel for the web also provides fill, font, and conditional formatting controls, but available custom-color fields can vary. If you cannot enter a hex code directly, convert it to RGB and use the custom color controls if offered. If the web picker does not provide a way to enter the required custom values, open the workbook in the desktop app.
Common Mistakes
- Mixing up fill and font color. Choosing Font Color will not change the background, and choosing Fill Color will not change the text. Check the button label before choosing a swatch.
- Entering hex characters into RGB boxes. RGB boxes expect three decimal numbers from 0 to 255, not a string such as #1F4E78. Convert each pair of hex digits separately, then enter the three results in order.
- Including the # when the field does not accept it. Hex input varies by picker. If the value is rejected, try the six characters without #, or use RGB fields instead. Do not remove characters from the code itself.
- Formatting the wrong range. A single selected cell receives a manual fill only; a conditional formatting rule may apply to a larger or smaller range than intended. Recheck the selection and the rule’s “Applies to” range.
- Expecting a manual fill to update automatically. A regular fill is fixed until someone changes it. Use conditional formatting if a cell’s color should respond to its value, date, or another condition.
- Using color as the only signal. Readers may print in grayscale or have difficulty distinguishing certain colors. Add labels, symbols, or clear headings so the worksheet remains understandable without relying on color alone.
Tips
- Keep a small color key. Add a note near the data explaining what each color means, such as blue for in progress and green for complete. This prevents a personal color scheme from becoming confusing to colleagues later.
- Record exact codes for recurring work. Keep the RGB or hex values in a documentation sheet or workbook style guide. A swatch alone is less useful if you need to reproduce the same color in another workbook.
- Use one consistent color for one meaning. If orange means “needs review” in one section, avoid using it for an unrelated category elsewhere. Consistent meanings make a large sheet easier to scan.
- Choose a restrained palette. Use a few colors for categories or status, not a different shade for every row. Too many strong fills compete with the information and make important exceptions harder to spot.
- Use conditional formatting for changing data. It is useful for due dates, negative values, duplicates, or status labels that change over time. Use manual fills for static headings, section labels, or cells whose meaning does not depend on their contents.
- Check printing and contrast. Review the worksheet at normal zoom and, when relevant, in print preview. Pale fills can disappear on paper, while dark fills can make black text hard to read.
Troubleshooting
The color picker has no hex box. Use its RGB controls if available. Convert the six-digit hex code into three decimal values: split it into pairs, convert each pair from hexadecimal to decimal, and enter them as Red, Green, and Blue. For instance, #1F4E78 becomes 31, 78, 120. If you are unsure about a conversion, use a trusted converter or ask the person who supplied the code for RGB values.
The color did not change. Make sure the correct cells were selected and that you clicked the arrow beside Fill Color or Font Color before choosing a custom color. If the cells are part of a table, a table style may affect their appearance. If conditional formatting is present, its rule may override the manual fill for cells that meet the rule. Check Conditional Formatting > Manage Rules and adjust or remove the conflicting rule if appropriate.
The color changes back after editing a value. That usually indicates conditional formatting is controlling the appearance. Inspect the rules for the selected range, then edit the condition or its format. If you want a permanent color instead, remove the relevant conditional formatting rule and apply a manual fill.
The result looks unlike the reference color. Verify that the code was copied correctly, including all six hex digits, and that you did not reverse the red and blue values. Also confirm that the reference is an RGB color rather than a color from a theme or another color model. A screen, printer, or display setting can affect how a color appears, so a visual comparison may not be exact.
Format Painter copied unwanted styling. Undo immediately if needed, then apply the color through the Fill Color menu instead. Format Painter copies a set of formatting attributes, not just the fill, so it may also bring over borders, fonts, or number formats.
Frequently Asked Questions
Can I enter a hex color code directly in Excel?
Some Microsoft 365 color pickers include a hex field, but the option and layout can vary. If you do not see one, use RGB values in the custom color dialog when available.
What is the difference between RGB and hex?
They describe the same kind of screen color in different formats. RGB gives separate red, green, and blue values from 0 to 255; hex writes those channel values as pairs of hexadecimal digits, often preceded by #.
Can Excel color cells automatically based on their values?
Yes. Select the cells and use Home > Conditional Formatting to create a rule, such as highlighting values above or below a threshold. The formatting updates as values change.
How do I remove a cell’s color?
Select the cells, open the arrow beside Fill Color, and choose No Fill. To remove text color formatting, use the Font Color menu and choose Automatic or the default font color option. If a rule is applying the color, remove or edit that rule as well.
Will a custom color be available in every workbook?
A color you recently used may appear in the current workbook’s palette, but do not assume it will be easy to find in every file or on every computer. Keep the RGB or hex code in your project notes so you can recreate it reliably.
Does changing a cell’s color change its value?
No. Fill and font colors are formatting; they do not change the cell’s text, number, or formula result. Conditional formatting also changes only the appearance, not the underlying value.
Related
- Google Sheets Inventory Spreadsheet: Setup and Tips
- Inventory Spreadsheet: Simple Setup and Useful Tips
- Inventory List Spreadsheet Template: Build and Use One
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Word Mail Merge: Remove Decimal Places from Number FieldsTo remove decimal places from a Word mail merge result, edit the merge field and add the number-format…
- Excel Shortcut to Highlight All Data in a Column QuicklyIn Excel for Microsoft 365 on Windows, click the first cell in the column’s data and press Ctrl+Shift+Down…
- Conditional Formatting Excel Dates Overdue: How to Set It UpTo highlight overdue dates in Excel, select the cells to format and create a formula-based conditional formatting rule.…
- How to Add Page Numbers in Word Starting on Page 2To add page numbers in Word from the second page, insert a page number, then turn on Different…
- Real Estate Expense Tracker Excel Spreadsheet GuideYes. You can make a real estate expense tracker in Excel by recording each expense as one row,…
- Google Sheets: Count Cells That Contain Text with COUNTIFTo count cells that contain text in Google Sheets, use =COUNTIF(A2:A100,"*"), replacing A2:A100 with your range. The asterisk…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.