
Conditional formatting changes a cell's colour or font automatically based on its value. It is the fastest way to make the important parts of a large table stand out, and the colours update as the data changes.
Built-in rules
Select a range and click Home > Conditional Formatting to see the ready-made options:
- Highlight Cells Rules: greater than, less than, between, text that contains, duplicate values.
- Top/Bottom Rules: top 10 items, above average and similar.
- Data Bars, Color Scales, Icon Sets: visual comparison of values.
To turn negative budget values red, choose Highlight Cells Rules > Less Than and enter 0.
Formula rules: highlight an entire row
The real power is in formula-based rules. To shade every row in A2:F200 whose status column (E) says "Overdue":
- Select A2:F200 (without the header).
- Choose Conditional Formatting > New Rule > Use a formula to determine which cells to format.
- Enter the formula:
=$E2="Overdue"- Click Format and pick a fill colour.
The $ matters: it locks the column while the row number moves with each row. Always write the formula for the first row of your selection (row 2 here).
10 practical formula examples
| Goal | Formula (selection starts at A2) |
|---|---|
| Past due dates | =$D2<TODAY() |
| Due within 7 days | =AND($D2>=TODAY(),$D2<=TODAY()+7) |
| Sales above target | =$C2>=$H$1 |
| Empty required field | =ISBLANK($B2) |
| Weekend dates | =WEEKDAY($A2,2)>5 |
| Zebra stripes | =MOD(ROW(),2)=0 |
| Records missing from another list | =COUNTIF(List!$A:$A,$A2)=0 |
| Duplicates | =COUNTIF($A$2:$A$200,$A2)>1 |
| Cell contains a word | =ISNUMBER(SEARCH("urgent",$B2)) |
| Highest value in each row | =B2=MAX($B2:$F2) |
In the last example only the columns are locked, so each row is compared with itself.
Data bars and icons
Data Bars draw a small bar chart inside each cell, which works well for sales figures. To show only the bar, open Manage Rules > Edit Rule and tick "Show Bar Only". Icon Sets are great for tracking targets; defining thresholds as numbers rather than percentages gives more predictable results.
Manage your rules
Conditional Formatting > Manage Rules lists every rule:
- Order matters: the rule at the top is applied first.
- With Stop If True ticked, lower rules do not run for that cell.
- Change the range a rule covers in the Applies to column.
Performance and clean-up
Copying and pasting can split one rule into dozens of fragments and slow the workbook down. In Manage Rules, choose "This Worksheet", delete duplicates and apply a single rule to the full range. Using the table's real range instead of whole columns (A:A) for complex formulas also helps.
If you convert the range to an Excel table with Ctrl + T, new rows inherit the rules automatically.
Step-by-step example: turning overdue payments red automatically
A payment list: A: Customer, B: Due date, C: Amount, D: Paid? (Yes/No).
- Select the range: A2:D500.
- Home > Conditional Formatting > New Rule > Use a formula.
- Formula:
=AND($B2<TODAY(),$D2="No") - Format: red fill, bold text.
- A second rule (coming up):
=AND($B2>=TODAY(),$B2<=TODAY()+7,$D2="No")yellow fill. - A third rule (paid):
=$D2="Yes"grey text. - Check rule order and the "Stop if true" option.
- Review the applied range in Manage Rules.
In $B2 the dollar sign locks the column while the row is free; the whole row is thus painted by the same rule. For this logic see also our Excel tips and freeze panes guides.
10 practical rule templates
| Aim | Formula |
|---|---|
| Duplicate values | =COUNTIF($A$2:$A$500,$A2)>1 |
| Highlight a row with a blank | =COUNTBLANK($A2:$D2)>0 |
| Weekend dates | =WEEKDAY($A2,2)>5 |
| Top 10% | Built-in rule: Top 10% |
| Above average | Built-in rule |
| Containing specific text | =FIND("urgent",$A2)>0 or a built-in rule |
| Every second row | =MOD(ROW(),2)=0 |
| Those meeting the target | =$C2>=$E2 |
| A month-change line | =MONTH($A2)<>MONTH($A1) |
| Containing an error value | =ISERROR($C2) |
Performance and upkeep
- Keep the applied range only as large as needed; a full column with many rules slows things down.
- When duplicating rules by copy-paste note that ranges can fragment; clean up in Manage Rules.
- Don't let colour be the only information: add an icon or text for colour blindness.
- If the report will be printed make it readable in black and white too (see our Excel print area guide).
Frequently asked questions
Why isn't the rule working? The row/column locking ($) in the formula may be wrong; the "applies to" range may be wrong; dates/numbers may be text (see our data cleaning guide).
Can I refer to another sheet? Yes; by defining a name and using it in the rule or by a direct reference.
Filtering/counting by conditional format? You can filter by colour but for counting by colour a formula/helper column is safer.
How does it work in tables? Rules expand as the table expands (see our Excel tables guide).
Use in dashboards? Ideal for indicators and highlights (see our Excel dashboard guide).
Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.