Conditional Formatting in Excel, With Formula Rules and Examples

7 min read

Conditional formatting in Excel changes how a cell looks, its fill, font colour, border or an icon, based on the value in it. Select the cells, go to Home > Conditional Formatting, pick a rule such as Highlight Cells Rules > Less Than, enter the threshold and a format, and every cell that meets the condition is coloured. When the value changes, the colour updates by itself.

The built-in rules cover most needs. The one that separates a beginner from someone useful is “Use a formula to determine which cells to format”, because it lets you colour an entire row based on one column, or test two conditions at once. This lesson covers the built-in rules first, then formula rules, then managing rules once a sheet has a dozen of them.

The data used throughout

A pump manufacturer in Coimbatore sells through dealers across Tamil Nadu. Every month the sales head reviews a sheet of dealers: who hit target, who is behind, and whose payments are overdue. The October sheet has eight dealers, with headers in row 1. Achievement in column E is =D2/C2, formatted as a percentage.

A: Dealer B: City C: Target D: Sales E: Achievement F: Overdue days G: Last order
Sri Murugan Agencies Erode 800000 912000 114% 0 2026-11-08
Kaveri Pumps Salem 600000 438000 73% 45 2026-10-20
Annai Traders Madurai 900000 855000 95% 12 2026-11-03
Velan Enterprises Tiruppur 500000 610000 122% 0 2026-11-10
Lakshmi Electricals Trichy 700000 392000 56% 75 2026-09-28
Balaji Motors Karur 400000 404000 101% 31 2026-10-30
Selvam and Co Dindigul 650000 520000 80% 0 2026-11-05
Ganesh Agro Pollachi 550000 286000 52% 64 2026-10-02

On the real sheet there are 140 dealers. Nobody reads 140 rows of numbers in a review meeting; they read the colours.

The five kinds of built-in rule

Everything under Home > Conditional Formatting falls into one of these groups. The table shows where each sits and what it is good for.

Rule type Menu path What it does Good for
Highlight Cells Rules Home > Conditional Formatting > Highlight Cells Rules Colours cells greater than, less than, between or equal to a value, containing text, in a date range, or duplicated Flagging a threshold breach
Top/Bottom Rules Home > Conditional Formatting > Top/Bottom Rules Colours the top or bottom N items or N percent, or those above or below average Picking out leaders and laggards
Data Bars Home > Conditional Formatting > Data Bars Draws a bar inside each cell, scaled to its value Comparing sizes down a column
Color Scales Home > Conditional Formatting > Color Scales Shades cells on a two or three colour gradient Seeing a spread, like a heat map
Icon Sets Home > Conditional Formatting > Icon Sets Adds arrows, traffic lights or flags in bands Status at a glance

Built-in rules on the dealer sheet

Highlight dealers below 80 percent of target

Select E2:E9, then Home > Conditional Formatting > Highlight Cells Rules > Less Than. Type 80% in the box (or 0.8) and choose Light Red Fill with Dark Red Text.

Dealer Achievement Coloured?
Kaveri Pumps 73% Yes
Lakshmi Electricals 56% Yes
Ganesh Agro 52% Yes
Selvam and Co 80% No

Selvam is not coloured, because 80% is not less than 80%. If the business rule is “80 percent or below”, use Between with 0 and 80%, or a formula rule with E2<=80%. And type the percent sign. Achievement is stored as 0.8, not 80, so a rule of “less than 80” colours every dealer on the sheet.

Top 3 dealers by sales

Select D2:D9, then Top/Bottom Rules > Top 10 Items, change 10 to 3, and pick a green fill. Sri Murugan Agencies (912000), Annai Traders (855000) and Velan Enterprises (610000) turn green. If two dealers tie for third place, both are coloured, so you can see more than three.

“Above Average” on the same column happens to colour the same three dealers here, because the average is 552125. That is a coincidence of this data; on the full list the two rules give very different results.

Data bars on sales, colour scale on achievement

Select D2:D9 and choose Data Bars > Gradient Fill. Each cell gets a bar sized to its value, so the longest bar goes to Sri Murugan’s 912000 and the shortest to Ganesh Agro’s 286000. Select E2:E9 and choose Color Scales > Green – Yellow – Red. The highest achievement is green, the middle value yellow, the lowest red, and everything else a blend.

Use one of these per column, not both. A bar and a gradient on the same cells compete, and the eye cannot read either.

Traffic lights on overdue days

Icon sets need adjusting before they mean anything, for two reasons. First, the default thresholds are percentages of the range (the top third, middle third and bottom third), not the business’s own limits. Second, the default puts green on the highest value, and for overdue days a high number is bad.

Select F2:F9, choose Icon Sets > 3 Traffic Lights (Unrimmed), then Home > Conditional Formatting > Manage Rules > Edit Rule and set it up like this.

Setting Value
Reverse Icon Order Ticked, so red goes to high values
Red when value is >= 60, Type: Number
Yellow when value is >= 30, Type: Number
Green Everything below 30

The result: Lakshmi Electricals (75) and Ganesh Agro (64) get red, Kaveri Pumps (45) and Balaji Motors (31) get yellow, and the other four get green. Changing Type from Percent to Number is the step most people miss.

Formula rules: colouring a whole row

The built-in rules colour only the cell that holds the value. To colour the whole dealer row when overdue days pass 60, use a formula.

  1. Select A2:G9, starting from A2 so that A2 is the active cell.
  2. Home > Conditional Formatting > New Rule.
  3. Choose “Use a formula to determine which cells to format”.
  4. Type =$F2>60.
  5. Click Format, choose a fill, and click OK twice.

Lakshmi Electricals and Ganesh Agro are now red across all seven columns. The formula is written for the active cell, row 2, and Excel adjusts it for every other cell in the range. The dollar sign before F locks the column, so every cell in the row looks at column F. The row number has no dollar sign, so row 3 checks F3, row 4 checks F4, and so on. If the referencing rules are hazy, our post on absolute and relative cell references covers them; in conditional formatting they decide whether the rule works at all.

These are formula rules worth keeping. Each one is applied to A2:G9 with A2 as the active cell, and the last column is checked against the October data, with today taken as 12 November 2026.

Purpose Formula Rows coloured
Payment overdue more than 60 days =$F2>60 Lakshmi Electricals, Ganesh Agro
Met target with nothing overdue =AND($D2>=$C2, $F2=0) Sri Murugan Agencies, Velan Enterprises
No order in the last 30 days =$G2 Lakshmi Electricals, Ganesh Agro
Below 80% or more than 30 days overdue =OR($E2<80%, $F2>30) Kaveri Pumps, Lakshmi Electricals, Balaji Motors, Ganesh Agro
A specific city =$B2=”Madurai” Annai Traders
City typed in a control cell, J1 =$B2=$J$1 Whichever dealer’s city is in J1
Every other row, for readability =MOD(ROW(), 2)=0 Rows 2, 4, 6 and 8
Blank target cell =ISBLANK($C2) None on this sheet

The TODAY rule recalculates every day, so the sheet flags a dealer the morning their last order turns 31 days old, without anyone touching it. The J1 rule is the start of an interactive sheet: type a city in J1 and its dealers light up. Put a drop-down in J1 and nobody can type a city that does not exist; our lesson on data validation and drop-down lists, part of this series, shows how.

Testing a formula rule before you trust it

A formula rule fails silently. If it is wrong, nothing is coloured, or everything is. Type the same formula in a spare column first, copy it down, and check that it returns TRUE on exactly the rows you expect. Then delete the test column and paste the formula into the rule.

Managing rules once there are several

Home > Conditional Formatting > Manage Rules opens the list. Set “Show formatting rules for” to This Worksheet, or you only see the rules on the selected cells.

Column in the dialog What it controls
Rule The condition, in words or as the formula
Format A preview of the formatting
Applies to The range the rule covers; edit it here instead of recreating the rule
Stop If True When ticked, rules below this one are skipped for cells where it is true

Rules run from the top of the list down, and when two rules set the same property, such as fill colour, the higher rule wins. So put the most important rule first. On the dealer sheet, the red overdue row rule should sit above the green alternate-row shading, or the shading hides the warning on even rows.

To remove rules, use Home > Conditional Formatting > Clear Rules, then Clear Rules from Selected Cells or Clear Rules from Entire Sheet.

Mistakes that make conditional formatting lie

Locking the row as well as the column. =$F$2>60 makes every row look at F2. Sri Murugan’s F2 is 0, so nothing is coloured anywhere.

Starting the selection from the wrong cell. If the active cell is A5 when you type =$F2>60, Excel applies it with a three-row offset. Always select from the top-left cell of the range.

Comparing a percentage with a whole number. A rule of less than 80 on a column that displays 73% colours everything, because the cell holds 0.73.

Numbers stored as text. Values exported as text are skipped by greater-than and less-than rules. Convert them to numbers first.

Rules multiplying as you copy and paste. Copying formatted cells copies their rules, and inserting rows splits ranges. After a few weeks, Manage Rules shows twenty fragments of the same rule. Delete them and set one rule with a clean Applies to range.

Colouring everything. If half the sheet is red, nothing stands out. Two or three colours with clear meanings beat a rainbow.

Excel for Mac and Google Sheets

On a Mac, the menu is Home > Conditional Formatting with the same five groups. To write a formula rule, choose New Rule, then set the Style drop-down to Classic, and pick “Use a formula to determine which cells to format”. The formulas themselves are identical.

Google Sheets puts it at Format > Conditional formatting, where “Custom formula is” does the same job as Excel’s formula rule. Sheets has colour scales but no built-in data bars or icon sets.

Frequently asked questions

What is conditional formatting in Excel?

Conditional formatting changes a cell’s appearance, such as its fill colour, font or an icon, when its value meets a condition you set. It is found at Home > Conditional Formatting. The formatting updates automatically whenever the values change, so it works as a live visual check on the data.

How do I highlight an entire row based on one cell’s value?

Select the whole range starting from the top-left cell, go to Home > Conditional Formatting > New Rule, and choose “Use a formula to determine which cells to format”. Enter a formula with the column locked and the row free, such as =$F2>60, and pick a format. Every row where column F is above 60 is coloured across its full width.

How do I apply conditional formatting based on another cell?

Use a formula rule and refer to the other cell in the formula. To compare with a value in the same row, lock only the column, as in =$D2>=$C2. To compare every row with one fixed cell, such as a target typed in J1, lock it fully as $J$1.

Can I use IF in conditional formatting?

You do not need IF, because a conditional formatting formula only has to return TRUE or FALSE. Write the test directly, such as =$E2<80% or =AND($D2>=$C2, $F2=0). Wrapping it in IF works but adds nothing.

Why is my conditional formatting not working?

The most common causes are a wrong dollar sign (=$F$2 instead of =$F2), selecting the range from a cell other than the top-left one, numbers stored as text, and a percentage compared with a whole number. Another rule higher in the Manage Rules list can also be overriding it. Test the formula in a spare column to see where it returns TRUE.

How do I copy conditional formatting to other cells?

Select a formatted cell, click Format Painter on the Home tab, and brush over the new cells. Alternatively, open Manage Rules and extend the Applies to range, which keeps a single rule instead of creating copies. Paste Special with Formats also works but copies number formats and borders too.

Formatting is for decisions

Good conditional formatting answers one question per colour: who is behind, whose payment is late, which number is unusual. That same discipline is what makes a dashboard work, and it builds on the summaries in our guide to pivot tables. Expect a formula rule or two in any practical Excel interview.

SkilloVilla’s Excel: Beginner to Advanced course teaches conditional formatting in its workbook modules, along with formatting, data validation, conditional functions, charts and interactive dashboards, in live classes. If you want Excel inside a full analyst programme with SQL, Python and placement support, see the Data Analytics with Python track.

How to Remove Duplicates in Excel, and Clean the…

Remove duplicates in Excel with Data > Remove Duplicates, COUNTIFS, UNIQUE or Power Query, and clean the spaces and formats that hide duplicates.
SkilloVilla Team
8 min read

IF Formula in Excel, With Nested IF, IFS, AND…

The IF formula in Excel explained with examples, then nested IF, IFS, IF with AND and OR, and the mistakes that make an IF...
SkilloVilla Team
6 min read

Excel Formulas List for Data Analysts, Grouped by Job

An Excel formulas list for data analysts, grouped by job: lookups, text cleaning, dates, conditional sums, error checks and dynamic lists, with results.
SkilloVilla Team
8 min read

Leave a Reply