Highlight Rows with a Formula

Excel Formulas › Conditional Formatting

All versionsCustom ruleWhole-row

Conditional formatting can do far more than the built-in presets once you drive it with a formula. The key technique: highlight an entire row based on one cell’s value, using a rule with a cleverly locked reference.


Quick formula: to shade a whole row when its Status (column C) is “Overdue”, select the data and add a formula rule:
=$C2="Overdue"
Lock only the column ($C) and leave the row relative (2) so the rule slides down each row but always reads column C.

Functions used (tap for the full reference guide):

The example

An invoice list; overdue rows are shaded end-to-end.

ABC
1InvoiceAmountStatus
2INV-01$120Paid
3INV-02$80Overdue
4INV-03$200Paid
5INV-04$60Overdue

The formula

The conditional-formatting rule (not a cell formula) applied to the whole data range A2:C5:

=$C2="Overdue" // shades the entire row when status is Overdue

How it works

Set it up in four clicks, and the mixed reference does the magic:

  1. Select the full data range first — A2:C5before opening the rule, so it applies to every cell.
  2. Home → Conditional Formatting → New Rule → Use a formula to determine which cells to format.
  3. Enter =$C2="Overdue". The $C locks the column so every cell in a row checks column C; the relative 2 lets the rule move down row by row.
  4. Pick a fill color. Excel evaluates the rule for each cell; whenever its row’s C value is "Overdue", the cell — and thus the whole row — is shaded.

The single most common mistake: getting the dollar signs wrong. $C2 highlights whole rows. C2 (no lock) highlights only single cells and drifts. $C$2 (both locked) makes every cell test one fixed cell. For whole-row highlighting you want column-locked, row-relative: $C2.

Try it: interactive demo

Live demo

Choose what to highlight; see the rule and the result.

Variations

Highlight on a number threshold

Shade rows where the amount is over $150:

=$B2>150

Two conditions (AND)

Overdue and over $100:

=AND($C2="Overdue", $B2>100)

Highlight duplicate rows

Drive the rule with COUNTIF:

=COUNTIF($A$2:$A$100, $A2)>1

Pitfalls & errors

Only one cell highlights, not the row. You used C2 instead of $C2. Lock the column with a single dollar sign.

The rule applies to the wrong cells. Conditional formatting applies to whatever was selected when you created the rule. Check (and fix) the range in Manage Rules → Applies to.

The formula must return TRUE/FALSE. A conditional-formatting formula is a logical test, not a value — it should evaluate to TRUE or FALSE for each cell.

Practice workbook

📊
Download the free Highlight Rows with a Formula practice workbook
The invoice list with helper columns showing the TRUE/FALSE each rule produces (=$C2="Overdue", threshold, AND, duplicate), plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I highlight an entire row based on one cell in Excel?
Select the whole data range, add a conditional-formatting rule of type 'Use a formula', and enter =$C2="Overdue" (lock the column, not the row). Every row whose column C says Overdue is shaded.
Why does only one cell get highlighted instead of the whole row?
You didn't lock the column. Use $C2 (column-locked, row-relative) so each cell in a row checks column C. C2 with no dollar sign drifts; $C$2 tests a single fixed cell.
Can a conditional-formatting formula use AND or COUNTIF?
Yes. Any formula that returns TRUE/FALSE works, e.g. =AND($C2="Overdue", $B2>100) or =COUNTIF($A$2:$A$100, $A2)>1 to highlight duplicates.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Flag duplicates · IF with AND / OR · Rank values (no gaps)

Function references: AND · COUNTIF