Quick answer: Select the cells, then go to Home > Conditional Formatting. For a simple test, point to Highlight Cells Rules and pick a rule such as Greater Than, Text that Contains or Duplicate Values, enter the value and choose a format. For visual scales, pick Data Bars, Color Scales or Icon Sets instead. For anything the menus don’t offer, such as coloring a whole row, use New Rule > Use a formula to determine which cells to format. The formatting changes by itself when the values change.
In this guide
- Method 1: Highlight cells with a ready-made rule
- Method 2: Flag the top or bottom values
- Method 3: Add data bars, color scales or icon sets
- Method 4: Use the Quick Analysis button
- Method 5: Write your own rule with a formula
- Edit, reorder and stop rules
- Remove conditional formatting
- Excel for the web and Excel for Mac
- When a rule doesn’t apply as expected
- Related guides
Applies to: Excel for Microsoft 365, Excel 2024, Excel 2021, Excel 2019 and Excel 2016 on Windows, which Microsoft’s conditional formatting article lists together with Excel for the web. Microsoft’s formula-rule article for the Mac lists Excel for Microsoft 365 for Mac, Excel 2024 for Mac and Excel 2021 for Mac. The steps are written for Windows, and the methods start with the simplest one.
Conditional formatting changes how a cell looks (fill, font color, a bar or an icon) based on a rule about its value. Unlike formatting you apply by hand, the rule is checked again whenever the data changes, so a late invoice or a low stock count gets flagged without you hunting for it.
Method 1: Highlight cells with a ready-made rule
The Highlight Cells Rules menu covers simple comparisons. Microsoft’s article lists Greater Than, Between, Equal To, Text that Contains and Duplicate Values among its commands.
- Select the range to check, for example the amounts in B2:B50. Leave out the header row so the heading isn’t tested too.
- Go to Home > Conditional Formatting > Highlight Cells Rules.
- Pick the rule. For Greater Than, type the limit, such as 1000; for Text that Contains, type the word to find, such as Overdue; Duplicate Values needs no value.
- Choose a format from the list next to the value box, then select OK.
The value box can also take a cell reference instead of a typed number. Pointing the rule at a cell that holds the limit lets you change the threshold later without editing the rule; this tip isn’t from the Microsoft article, so check that the reference stays fixed in Manage Rules.
Duplicate highlighting only marks repeated entries; it doesn’t delete anything. To review and then remove the repeats, see How to remove duplicates in Excel.
Method 2: Flag the top or bottom values
When there’s no fixed limit and you want the best or worst performers, use Home > Conditional Formatting > Top/Bottom Rules. Microsoft names commands such as Top 10 items and Bottom 10 %. Despite the names, the dialog should let you change the number, for example to show only the top 3 sales figures; then pick a format and select OK.
These rules compare each cell with the rest of the selected range, so select the whole column of figures rather than part of it. If you add rows later, extend the range in Manage Rules (see below) so the new rows are ranked too.
Method 3: Add data bars, color scales or icon sets
These three options show the size of each value rather than a yes-or-no test, which helps you scan a long column of numbers. All three are on the Conditional Formatting menu:
- Data Bars: draw a bar inside each cell, longer for larger values. Choose Data Bars and pick a bar style.
- Color Scales: shade cells along a two-color or three-color scale, for example green for high and red for low. Hover over each scale to see which is which before you click.
- Icon Sets: add an arrow, flag or traffic light that puts each value in a band. Choose Icon Sets and pick a set.
Use these on numbers only. A color scale on a column that mixes numbers and text can be confusing, and Microsoft notes that Stop If True (covered below) doesn’t work with any of these three types.
Method 4: Use the Quick Analysis button
Quick Analysis offers a shorter route to the same rules. According to Microsoft:
- Select the data. A Quick Analysis button appears at the lower-right corner of the selection.
- Click the button, or press Ctrl+Q.
- On the Formatting tab, hover over an option to preview it, then click the one you want.
- If a Text that Contains box opens, type the text and select OK.
The choices depend on the data. Microsoft lists options such as Text, Duplicate, Unique and Equal To for text, and Data Bars, Colors, Icon Sets, Greater and Top 10% for numbers. The button may not appear in every version or for every selection; if it doesn’t, use the Home tab methods above.
Method 5: Write your own rule with a formula
A formula rule can test anything a formula can, including a value in a different column. Microsoft’s Windows articles describe this route:
- Select the cells the formatting should apply to.
- Go to Home > Conditional Formatting > New Rule.
- Under Select a Rule Type, choose Use a formula to determine which cells to format.
- Type a formula that starts with an equal sign and returns TRUE or FALSE. The format is applied where it returns TRUE. Microsoft warns that if you leave out the equal sign, Excel adds it along with quotation marks, and the rule won’t work until you delete the quotes.
- Select Format, choose the fill or font, and select OK to close each box. Microsoft’s articles don’t spell out these last buttons, so the labels on your screen may differ slightly.
Formula examples from Microsoft’s two articles:
- =MOD(ROW(),2)=1 shades every other row, a quick way to band a table.
- =A2>TODAY() (with A2:A7 selected) marks dates later than today.
- =COUNTIF($D$2:$D$11,D2)>1 (with D2:D11 selected) flags values that appear more than once.
Relative and absolute references. Write the formula for the first cell of the selection (the top-left one). Microsoft explains that a relative reference such as D2 lets Excel adjust the formula for each cell in the range, while clicking cells as you type the formula inserts absolute references such as $D$2, which stay fixed. In the COUNTIF example, the list $D$2:$D$11 is absolute so every cell checks the same list, and D2 is relative so each cell checks itself.
Highlight a whole row. To color every column of a row based on one column, select the full table without headers (for example A2:F100) and lock only the column letter, as in =$C2=”Overdue”. The dollar sign keeps every cell looking at column C, while the row number still moves down. Microsoft’s articles don’t show this mixed reference, so check the result on a few rows after you apply it. The same pattern works with a checkbox column; How to insert a checkbox in Excel explains the TRUE and FALSE values such a rule can test, and How to strikethrough text in Excel uses a rule like this to cross out finished tasks.
If the formula returns an error, Microsoft says the format isn’t applied. Wrapping the test in IFERROR, or an IS function such as ISNUMBER, gives the rule a TRUE or FALSE answer instead.
Edit, reorder and stop rules
Every rule lives in Home > Conditional Formatting > Manage Rules. If a rule you expect isn’t listed, check the list at the top of the box, which may be showing only the current selection. From there, according to Microsoft:
- Edit: select a rule and choose Edit Rule to change its test, format or range. Duplicate Rule copies a rule so you can make a variation.
- Order: rules are evaluated from top to bottom, and a higher rule wins when two conflict. New rules go to the top by default; use Move Up and Move Down to change the order.
- Stop If True: check this box on a rule to stop the rules below it from being evaluated for cells where it’s true. It can’t be used with data bars, color scales or icon sets.
Microsoft also notes that when a rule is true, its format overrides formatting you applied by hand to the same cells, and that hand formatting doesn’t appear in the rules list. That’s why a cell can keep its rule color even after you change its fill on the Home tab.
Remove conditional formatting
- Selected cells: Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells.
- Whole sheet: Home > Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.
- Find the cells first: to select every cell that shares a rule, Microsoft suggests Find & Select > Go To Special, then Conditional formats and Same.
Clearing rules only removes the formatting they add; your values and any formatting applied by hand stay. To remove one rule and keep the others, delete it in Manage Rules instead.
Excel for the web and Excel for Mac
Excel for the web: Microsoft lists Excel for the web on its conditional formatting article but gives no separate steps for it. Look for Conditional Formatting on the Home tab; the browser version may offer fewer options than the desktop app. If an option is missing, open the file in the desktop app to finish the rule.
Excel for Mac: Microsoft’s Mac article creates a formula rule through Home > Conditional Formatting > New Rule, then sets the rule type to Use a formula to determine which cells to format and picks a custom format. You may need to change the Style list in that box first before the rule types appear. The ready-made rules should sit on the same Home tab menu, though Mac keyboard shortcuts may differ from the Windows ones.
When a rule doesn’t apply as expected
The causes below are possibilities to check, not a diagnosis.
| What you see | Possible cause | What to try |
|---|---|---|
| Only the first cell is colored | Formula uses an absolute reference such as $C$2 | Edit the rule; use $C2 or C2 |
| Whole row colored on the wrong row | Formula written for a cell other than the top-left one | Rewrite it for the first row of the range |
| Rule seems to be ignored | A higher rule wins, or Stop If True is on | Reorder rules in Manage Rules |
| Numbers not highlighted by Greater Than | Values are stored as text | Convert the text to numbers, then check again |
| Formula rule shows nothing | Formula returns an error | Wrap the test in IFERROR |
| Color won’t go away | A rule, not hand formatting, sets it | Clear Rules from Selected Cells |
Once the highlights are in place, a pivot table can sum up what they show; see How to create a pivot table in Excel. For more time-savers, Excel tips and tricks collects shortcuts for everyday work.
Related guides
- How to remove duplicates in Excel
- How to insert a checkbox in Excel
- How to strikethrough text in Excel
- How to create a pivot table in Excel
- Excel tips and tricks: 10 ways to work faster in Excel
Leave a Reply