Lesson 23 of 92 · Free Excel Course
Excel
Conditional Formatting in Excel: Highlight Cells, Data Bars and Formula Rules
Use Excel conditional formatting to highlight values, dates and duplicates, add data bars and icons, colour whole rows with a formula, and manage rules.
A list of numbers doesn't tell you much at a glance. Which invoices are big? Which ones are unpaid? Which clients appear twice? Conditional formatting answers questions like these by colouring cells automatically when they meet a rule you set, such as "greater than 1,000". Change a number and the colour updates by itself. This lesson covers every kind of rule on one small invoice list.
What conditional formatting does
A conditional formatting rule has three parts: which cells it watches, the condition (the test) and the format it applies when the test is true. You'll find everything under Home, then Conditional Formatting, in the Styles group. The menu has five ready-made groups (Highlight Cells Rules, Top/Bottom Rules, Data Bars, Color Scales, Icon Sets) plus New Rule, Clear Rules and Manage Rules.
On Windows, you can also select some numbers and press Ctrl+Q (Quick Analysis): its Formatting tab previews the common rules as you hover.
The rule never changes what's in the cell. A highlighted 1,250 is still 1,250, so your totals, sorting and formulas carry on as normal. Here's the invoice list used through this lesson:
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Invoice | Client | Amount | Due date | Status |
| 2 | INV-101 | Acme | $1,250 | 10/5/2026 | Paid |
| 3 | INV-102 | Birch Co | $480 | 10/12/2026 | Unpaid |
| 4 | INV-103 | Cole Ltd | $2,100 | 10/20/2026 | Paid |
| 5 | INV-104 | Dune Inc | $760 | 11/2/2026 | Unpaid |
| 6 | INV-105 | Acme | $310 | 11/10/2026 | Paid |
| 7 | INV-106 | Elm & Co | $1,890 | 11/18/2026 | Paid |
| 8 | INV-107 | Birch Co | $940 | 11/25/2026 | Unpaid |
| 9 | INV-108 | Fern LLC | $1,020 | 12/1/2026 | Unpaid |
| 10 | INV-109 | Cole Ltd | $150 | 12/8/2026 | Paid |
| 11 | INV-110 | Dune Inc | $1,600 | 12/15/2026 | Unpaid |
Highlight Cells Rules: Greater Than and Between
The quickest rules compare each cell with a number you type. To colour every invoice over $1,000:
- Select the amounts, C2:C11.
- Click Home, then Conditional Formatting, then Highlight Cells Rules, then Greater Than.
- Type 1000 in the box. Excel shows a live preview straight away.
- Leave the format on Light Red Fill with Dark Red Text, or pick another preset from the list (or Custom Format for your own colours).
- Click OK.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Invoice | Client | Amount | Due date | Status |
| 2 | INV-101 | Acme | $1,250 | 10/5/2026 | Paid |
| 3 | INV-102 | Birch Co | $480 | 10/12/2026 | Unpaid |
| 4 | INV-103 | Cole Ltd | $2,100 | 10/20/2026 | Paid |
| 5 | INV-104 | Dune Inc | $760 | 11/2/2026 | Unpaid |
| 6 | INV-105 | Acme | $310 | 11/10/2026 | Paid |
| 7 | INV-106 | Elm & Co | $1,890 | 11/18/2026 | Paid |
| 8 | INV-107 | Birch Co | $940 | 11/25/2026 | Unpaid |
| 9 | INV-108 | Fern LLC | $1,020 | 12/1/2026 | Unpaid |
| 10 | INV-109 | Cole Ltd | $150 | 12/8/2026 | Paid |
| 11 | INV-110 | Dune Inc | $1,600 | 12/15/2026 | Unpaid |
Between works the same way but asks for two numbers. Select C2:C11 again, choose Highlight Cells Rules, then Between, type 500 and 1000, and choose Yellow Fill with Dark Yellow Text. Both ends count, so a 500 or a 1,000 would be included. Less Than and Equal To work the same way.
You can stack rules on the same cells, and you can type a cell address such as =$H$1 into the box instead of 1000, so you can change the limit later without editing the rule.
Text that Contains, A Date Occurring and Duplicate Values
The rest of the Highlight Cells Rules menu handles text, dates and repeats.
Text that Contains. Select E2:E11, choose Highlight Cells Rules, then Text that Contains, and type Unpaid. Five statuses light up. Be careful with short words: if you type Paid, all ten cells turn red, because "Unpaid" contains the letters "paid" and the test ignores capitals.
A Date Occurring. Select D2:D11, choose A Date Occurring, and pick a period from the list, such as Yesterday, This week, Last month or Next month. These follow the calendar, so the highlight moves as the days go by. For "any date before today", you need a formula rule, covered below. (More on dates in Dates and times.)
Duplicate Values. Select B2:B11, choose Duplicate Values, and click OK. Every client name that appears more than once turns red: Acme, Birch Co, Cole Ltd and Dune Inc, eight cells in all. Elm & Co and Fern LLC stay plain. Switch the first box from Duplicate to Unique to colour the one-offs instead. For deleting repeats rather than just spotting them, see Find and remove duplicates.
Top/Bottom Rules: top 3 and above average
These rules don't need you to know a number. Excel ranks the cells for you.
- Select C2:C11.
- Choose Conditional Formatting, then Top/Bottom Rules, then Top 10 Items.
- Change 10 to 3 and pick Green Fill with Dark Green Text. Click OK.
The three biggest invoices turn green: 2,100, 1,890 and 1,600. The same menu has Top 10 %, Bottom 10 Items, Bottom 10 %, Above Average and Below Average.
Above Average is worth a closer look, because it isn't the same as "over 1,000". The ten amounts add up to 10,500, so the average is 1,050. Above Average colours 1,250, 2,100, 1,890 and 1,600, but not 1,020.
Data Bars, Color Scales and Icon Sets
These three draw a picture of the numbers instead of picking out a few cells.
- Data Bars put a bar inside each cell, sized against the other values in the range. Select C2:C11, choose Data Bars, and pick a colour.
- Color Scales shade every cell on a gradient. With Green - Yellow - Red, the biggest amounts are green, the middle ones yellow and the smallest red.
- Icon Sets add a small symbol, such as arrows, traffic lights or stars, based on where each value sits in the range.
| A | B | C | |
|---|---|---|---|
| 1 | Invoice | Client | Amount |
| 2 | INV-101 | Acme | $1,250 |
| 3 | INV-102 | Birch Co | $480 |
| 4 | INV-103 | Cole Ltd | $2,100 |
| 5 | INV-104 | Dune Inc | $760 |
| 6 | INV-105 | Acme | $310 |
| 7 | INV-106 | Elm & Co | $1,890 |
| 8 | INV-107 | Birch Co | $940 |
| 9 | INV-108 | Fern LLC | $1,020 |
| 10 | INV-109 | Cole Ltd | $150 |
| 11 | INV-110 | Dune Inc | $1,600 |
To change how a bar, scale or icon set picks its colours, open Manage Rules, select the rule and click Edit Rule.
Highlight a whole row with a formula
The ready-made rules only colour the cells they test. To colour the whole invoice row when the amount is over 1,000, use a formula rule.
- Select A2:E11, dragging from A2 so that A2 is the active (white) cell. Don't include the heading row.
- Choose Conditional Formatting, then New Rule.
- Pick Use a formula to determine which cells to format.
- In the box, type
=$C2>1000. - Click Format, open the Fill tab, choose a light yellow and click OK, then OK again.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Invoice | Client | Amount | Due date | Status |
| 2 | INV-101 | Acme | $1,250 | 10/5/2026 | Paid |
| 3 | INV-102 | Birch Co | $480 | 10/12/2026 | Unpaid |
| 4 | INV-103 | Cole Ltd | $2,100 | 10/20/2026 | Paid |
| 5 | INV-104 | Dune Inc | $760 | 11/2/2026 | Unpaid |
| 6 | INV-105 | Acme | $310 | 11/10/2026 | Paid |
| 7 | INV-106 | Elm & Co | $1,890 | 11/18/2026 | Paid |
| 8 | INV-107 | Birch Co | $940 | 11/25/2026 | Unpaid |
| 9 | INV-108 | Fern LLC | $1,020 | 12/1/2026 | Unpaid |
| 10 | INV-109 | Cole Ltd | $150 | 12/8/2026 | Paid |
| 11 | INV-110 | Dune Inc | $1,600 | 12/15/2026 | Unpaid |
Why does this work? Excel writes the formula as if for the active cell, A2, then shifts it for every other cell, just like copying a formula (see Absolute and relative references).
- The $ before C locks the column. Cell E2 still checks C2, not E2. Without the $, each cell would test the cell two columns to its right and you'd get odd results.
- No $ before 2 lets the row move. Row 7 checks C7, row 11 checks C11.
- The row number must match the first row you selected. If you selected from A2 but typed
=$C1>1000, every row would check the row above it.
The formula must give TRUE or FALSE. A few more you can try in the same way:
- Overdue invoices:
=$D2<TODAY()colours any row whose due date has passed. It rechecks every day. - Overdue and unpaid:
=AND($E2="Unpaid",$D2<TODAY()). - Text anywhere in a cell:
=ISNUMBER(SEARCH("Co",$B2)).
Say today is November 22, 2026. The due dates in rows 2 to 7 have passed, so =$D2<TODAY() colours six rows, but three of those are already paid. The AND version only colours rows that pass both tests: INV-102 (unpaid, due October 12) and INV-104 (unpaid, due November 2). On November 26, INV-107 joins them without you touching the rule.
If a formula rule doesn't seem to work, test it in a spare column first: type =$C2>1000 in F2 and fill it down. Once TRUE shows in the right rows, the same formula will work as a rule.
Manage rules: order, editing and Stop If True
Click Conditional Formatting, then Manage Rules to open the Conditional Formatting Rules Manager. Change Show formatting rules for to This Worksheet to see every rule on the sheet, not just the selected cells.
- Edit Rule changes the condition or format. Delete Rule removes one rule.
- Applies to shows the range each rule covers. Type a new range there to stretch a rule over more rows.
- Rules run top to bottom. If two rules try to set the same thing, such as fill colour, the higher one wins. Use the Move Up and Move Down arrows to change the order.
- Stop If True: tick it on a rule and, when that rule is true for a cell, Excel skips the rules below it for that cell. It isn't available for data bars, color scales or icon sets.
A conditional format also beats any fill you added by hand, which is why a manual colour sometimes seems to "disappear".
Clear rules and copy them with Format Painter
To remove rules, choose Conditional Formatting, then Clear Rules, then Clear Rules from Selected Cells or Clear Rules from Entire Sheet. Inside a table or pivot table you'll also see options to clear just that.
To copy rules to other cells, click a cell that has them, click Format Painter (the paintbrush on the Home tab), then drag over the new cells. Double-click the paintbrush to paint several places, and press Esc to stop. To find which cells on a sheet have rules, use Home, Find & Select, then Conditional Formatting.
Mac and Excel for the web
Mac: the same Conditional Formatting button is on the Home tab, with Highlight Cells Rules, Top/Bottom Rules, Data Bars, Color Scales, Icon Sets, Manage Rules and Clear Rules. For a formula rule, choose New Rule, set the Style box to Classic, then choose Use a formula to determine which cells to format.
Excel for the web: the menu is on Home in the Styles group. New Rule and Manage Rules open a pane on the right instead of a dialog: you set Apply to range, pick a Rule type (Formula is one of them) and click Done. Microsoft's web instructions don't include Stop If True, so use the desktop app if you need it.
Which rule should I use?
| You want to... | Use |
|---|---|
| Flag values over, under or between fixed numbers | Highlight Cells Rules: Greater Than, Less Than, Between |
| Spot a word or status | Text that Contains (or a formula for an exact match) |
| See what's due this week or last month | A Date Occurring |
| Find repeated names or IDs | Duplicate Values |
| Pick out the best or worst few | Top/Bottom Rules |
| Compare every value at a glance | Data Bars, Color Scales or Icon Sets |
| Colour a whole row, or test two things at once | New Rule with a formula |
You can also sort or filter by the colour a rule adds, to pull all the red rows to the top (see Sort and filter).
Try it yourself
Download the practice workbook. Rules can't be pre-built in the file, so the Your task sheet lists the steps and the Answer key sheet shows, in Excel's own colours, exactly which cells should light up.
- On Practice, add Greater Than 1000 and Between 500 and 1000 to C2:C11.
- Add Text that Contains Unpaid to E2:E11, and Duplicate Values to B2:B11.
- Try Top 10 Items (set to 3), Data Bars, Color Scales and Icon Sets on C2:C11.
- Select A2:E11 and add the formula rule
=$C2>1000. Five whole rows light up. - Open Manage Rules and practise moving and deleting rules.
Common mistakes
- Missing $ in a row rule.
=C2>1000on A2:E11 checks a different column for each cell. Use=$C2>1000. - Wrong starting row. The formula's row must match the top row of your selection. Selected from row 2? Write row 2.
- Short "contains" text. "Paid" also matches "Unpaid". Use the full word, or a formula like
=$E2="Paid"for an exact match. - Rules piling up. Copying and pasting cells copies their rules too, and you can end up with dozens. Tidy them in Manage Rules.
- Numbers stored as text. Greater Than ignores amounts typed as text (often left-aligned with a green triangle). Convert them to numbers first (Format cells shows how).
What's next
You can now make important values, dates and repeats jump out of any list, and colour whole rows with a formula. The next lesson, Excel tables, turns a list into a table that formats, filters and totals itself, and rules you add there stretch to new rows automatically. If you missed it, go back to Drop-down lists and data validation, or see the full Excel course.
Frequently asked questions
How do I highlight an entire row based on one cell in Excel?
Select the whole data area starting from the top-left cell (for example A2:E11), then Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Type a formula that locks the column but not the row, such as =$C2>1000, pick a fill and click OK. The $ keeps every cell in the row looking at column C.
How do I highlight dates that are overdue?
For a quick version, select the dates and use Highlight Cells Rules > A Date Occurring (choices like Yesterday or Last week). For anything before today, use a formula rule such as =$D2<TODAY() on the whole table. To flag only unpaid ones, combine tests: =AND($E2="Unpaid",$D2<TODAY()). The rule rechecks against today's date every time the file recalculates.
Does conditional formatting change the value in the cell?
No. It only changes how the cell looks. The number or text stays exactly the same, so formulas, sorting and totals are not affected. Delete the rule and the cell goes back to its normal look.
How do I remove conditional formatting?
Select the cells, then Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. To wipe every rule on the sheet, choose Clear Rules from Entire Sheet. To delete just one rule, open Manage Rules, select it and click Delete Rule.
Can I copy conditional formatting to other cells?
Yes. Click a cell that has the rule, click Format Painter on the Home tab, then drag across the new cells. Double-click Format Painter to paint several areas, and press Esc when you're done. Check Manage Rules afterwards, because copying can leave you with extra rules.
What does Stop If True do?
It's a check box in the Conditional Formatting Rules Manager on the desktop app. When a rule with Stop If True ticked is true for a cell, Excel doesn't check the rules below it for that cell. It isn't available for data bars, color scales or icon sets.