Field Guide

Conditional formatting in Excel: rules, bars, and formulas

Updated

To apply conditional formatting in Excel: select the cells, then on the Home tab, in the Styles group, select Conditional Formatting and pick a rule, for example Highlight Cells Rules > Greater Than. Type the value the rule tests against, choose a format, and select OK. Every cell that meets the condition takes the format, and because it is a rule rather than a one-time paint, a cell loses the format again if its value later stops meeting the condition.

This page covers the whole feature: the Highlight Cells Rules for greater-than, between, and text matches, the duplicate and date rules, the visual formats (data bars, color scales, and icon sets), formula rules that read another cell or color a whole row, and how to manage or clear the rules once they stack up. The ribbon path is the same in the desktop app and in Excel for the web, where the rules open in a side pane instead of a dialog box.

How do I highlight cells greater than a value?

Point to Highlight Cells Rules and the submenu lists Greater Than, Less Than, Between, Equal To, and Text that Contains (plus A Date Occurring and Duplicate Values, both covered further down). Choose one, type the value or values it needs, pick a format, and select OK. Between takes two numbers, for example 100 and 200, and shades everything in that span; Text that Contains takes a string, so Contains “Silver” flags every cell with Silver in it.

A B
1 Item Amount
2 Paper 45
3 Cables 90
4 Toner 130
5 Monitor 260
Home > Conditional Formatting > Highlight Cells Rules > Greater Than, with 100 entered, shades every amount above 100, here 130 in B4 and 260 in B5. The other two amounts stay plain.

The neighboring Top/Bottom Rules menu shades the extremes instead of a fixed cutoff: Top 10 Items, Bottom 10%, Above Average, and Below Average. The count is adjustable from 1 to 1000, and the percentage from 1 to 100, so Top 10 Items can just as easily mark the top 5 or the top 25.

How do I highlight duplicate values or dates?

Both are quick rules under Highlight Cells Rules. For repeats, select the cells and choose Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, then pick a format; every value that appears more than once in the selection takes it. This only marks the duplicates, it does not delete anything, so it pairs naturally with the delete step in remove duplicates in Excel, which keeps the first occurrence and removes the later matches. If a deduplication run leaves repeats behind, a formatting language that uses double-byte characters can treat halfwidth and fullwidth as the same; Microsoft’s fallback there is a COUNTIF rule, =COUNTIF($A$2:$A$400,A2)>1, written as a formula rule.

For dates, choose Home > Conditional Formatting > Highlight Cells Rules > A Date Occurring and select a span such as Yesterday, Last Month, or Next Week. One catch before you rely on it: a date rule matches real date values, not dates typed as text. A cell showing 3/8/2026 that is actually a text string will not be caught, because the comparison goes by the value Excel holds, not the characters on screen. Whether a cell holds a true date or looks like one is the subject of Excel date formats.

What are data bars, color scales, and icon sets?

These three turn a column of numbers into something you read at a glance. On the Home tab, select Conditional Formatting, then Data Bars, Color Scales, or Icon Sets, and pick a style from the gallery.

One shared limit: if a cell holds a formula that returns an error, none of these formats apply to it, the same gotcha the formula rules below run into.

How do I format a row based on another cell’s value?

The quick rules judge each cell by its own value. To format a cell based on a different cell, or to light up an entire row, you write the test yourself. Select the range, then choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and type a formula in the box. Microsoft’s one rule for that formula: “You have to start the formula with an equal sign (=), and the formula must return a logical value of TRUE (1) or FALSE (0).”

To color a whole row, apply the rule to every column of the row range and anchor the column you are testing:

fx
=$B2>100
A B C
1 Item Amount Owner
2 Paper 45 Lee
3 Cables 90 Ford
4 Toner 130 Ray
5 Monitor 260 Kim
The rule applies to A2:C5 with the formula =$B2>100. Excel checks each row against column B, so rows 4 and 5 (Amount above 100) format across all three columns, while rows 2 and 3 stay plain.

The formula is written as if it lived in the top-left cell of the range (A2 here), and Excel slides it down and across the rest. That makes the anchor the whole game:

=$B2>100
Lock the column, free the row. The dollar sign fixes column B, so every cell in a row is judged by the Amount in that row. The row number has no dollar sign, so it slides from 2 down to 5 as the rule walks down the range. Drop the dollar sign and each column would read a different neighbor, and the row would not light up as one.

Because the test points at column B while the format lands on the whole row, this is also the pattern for formatting one cell based on another: aim the formula at the cell you want to watch. If a watched cell holds a formula that errors, the rule skips it; wrap the source in IFERROR or an IS function when you need erroring cells to format too. What each error code means is covered in Excel errors explained.

How do I manage or clear conditional formatting rules?

Rules pile up, and two of them can land on the same cell. Open Home > Conditional Formatting > Manage Rules to see, edit, reorder, or delete every rule in the selection or sheet. Order decides the outcome when rules conflict: “A rule higher in the list has greater precedence than a rule lower in the list.” New rules go to the top by default, so keep an eye on where they land, and reorder with the Move Up and Move Down arrows. The Stop If True check box halts evaluation at that rule, which mostly matters for compatibility with older Excel versions that cap the number of rules per range.

To take formatting off, select Home > Conditional Formatting > Clear Rules, then Clear Rules from Selected Cells or Clear Rules from Entire Sheet. To drop a single rule while keeping the others, delete it inside Manage Rules. In Excel for the web the commands sit in the same place, under Home > Styles > Conditional Formatting, but the rules open and are managed in a side pane rather than the dialog boxes.

The short version

Frequently asked questions

How do I apply conditional formatting in Excel?
Select the cells you want to format, then on the Home tab, in the Styles group, select Conditional Formatting. Pick a rule from the menu, for example Highlight Cells Rules, Top/Bottom Rules, Data Bars, Color Scales, Icon Sets, or Use a formula to determine which cells to format. Enter any value the rule needs and choose a format, then select OK. Every cell that meets the condition takes the format.
How do I highlight cells greater than a value in Excel?
Select the cells, then choose Home > Conditional Formatting > Highlight Cells Rules > Greater Than, type the number, and pick a format. The submenu also holds Less Than, Between, Equal To, and Text that Contains. Between takes two values, for example 100 and 200, and shades everything in that span.
What are data bars, color scales, and icon sets?
They are the three visual formats under Conditional Formatting. A data bar fills each cell with a bar sized to its value. A color scale shades cells on a gradient between two or three colors. An icon set drops a small icon (an arrow, a traffic light, a flag) beside each cell to show which band its value lands in. All three live under Home > Conditional Formatting.
How do I use conditional formatting based on another cell?
Select the range, choose Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter a formula that points at the other cell. To light up a whole row when column B is over 100, apply the rule to the row range and use =$B2>100. The dollar sign locks column B while the row slides, so lock the column and free the row.
How do I highlight duplicates or dates in Excel?
For duplicates, select the cells and choose Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, then pick a format. For dates, choose Home > Conditional Formatting > Highlight Cells Rules > A Date Occurring and select a span such as Last Month or Next Week. A date rule only matches real date values, not dates typed as text.
How do I clear conditional formatting in Excel?
On the Home tab, select Conditional Formatting > Clear Rules, then Clear Rules from Selected Cells or Clear Rules from Entire Sheet. To remove one rule while keeping the rest, open Manage Rules, select the rule, and delete it there.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.