Cellwise Try it free

Excel guide · 4 min read

Highlight an entire row based on one cell's value

Quick answerSelect the data rows (A2:E9), go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, enter =$D2="Cancelled" and pick a fill. The $ before D makes every cell in the row check column D, so the whole row changes color.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFG
1OrderCustomerNotesStatusAmountShow status
2SO-5501Fernhill ClinicStandardShipped420Pending
3SO-5502Ashby MotorsURGENT - site downPending1850
4SO-5503Wren & CoStandardCancelled260
5SO-5504Halden HotelsGift wrapPending640
6SO-5505Copper KettleShipped95
7SO-5506Ashby MotorsUrgentPending310
8SO-5507StandardPending1200
9SO-5508Lumen LabsStandardcancelled540

Download this sheet as an Excel practice file (.xlsx)

Create the rule

A formula rule must return TRUE or FALSE. Excel writes the rule for the active cell, the first one in your selection, and then adjusts it for every other cell the same way a formula adjusts when you copy it. That is why you write row 2 even though the rule covers rows 2 to 9.

  1. Select A2:E9. Start the selection in A2 so A2 is the active cell, and leave out the header row.
  2. Home > Conditional Formatting > New Rule.
  3. Choose "Use a formula to determine which cells to format".
  4. Type =$D2="Cancelled" in the box.
  5. Click Format, choose a fill (and a strikethrough on the Font tab if you like), then OK twice.

Why $D2 and not D2 or $D$2

$D2 is a mixed reference. The $ locks the column, so every cell in a row looks at column D. The row number has no $, so row 5 checks D5 and row 9 checks D9.

Without the $, =D2 in A2 means "the cell three columns to the right". Excel shifts it for B2 to check E2 and for C2 to check F2, so only part of the row colors, or the wrong part. With $D$2, every cell in every row checks D2, so the whole table is colored or none of it is. The check below is what the rule calculates for row 4.

Text comparisons in rules are not case-sensitive, so cancelled in row 9 matches too.

=$D4="Cancelled"

Result: TRUE

TRUE, so all five cells of row 4 (Wren & Co) turn the rule's color. Row 9's lowercase "cancelled" is TRUE as well.

Highlight the row if a cell contains a word

An equals test needs an exact match. To catch "URGENT - site down" and "Urgent" alike, search inside the cell. SEARCH returns the position of the text, or an error when it is missing, and ISNUMBER turns that into TRUE or FALSE.

SEARCH ignores case. Use FIND instead if case matters. Apply it the same way: select A2:E9 and enter =ISNUMBER(SEARCH("urgent",$C2)) as a new rule.

=ISNUMBER(SEARCH("urgent",$C3))

Result: TRUE

TRUE for SO-5502, whose note is "URGENT - site down". Row 7 ("Urgent") is TRUE too.

Numbers and two conditions together

Any formula that returns TRUE or FALSE works. To flag large orders that are still waiting, combine two tests with AND, each locked to its column.

Conditional formatting cannot be counted or filtered by formula, so count with the same logic using COUNTIFS. For this table, =COUNTIFS(D2:D9,"Pending",E2:E9,">=1000") gives 2: SO-5502 and SO-5507.

=AND($D3="Pending",$E3>=1000)

Result: TRUE

TRUE for SO-5502: Pending and 1,850. Row 5 is Pending but only 640, so it stays plain.

One color per status, or a status you pick

Add one rule per value, such as green for Shipped, amber for Pending and grey for Cancelled. All of them use the same A2:E9 range. When two rules set the same format, the one higher in Home > Conditional Formatting > Manage Rules wins, and you can reorder them with the arrows there.

To highlight whatever status someone chooses, point the rule at an input cell and lock it completely: =$D2=$G$2. Add a drop-down to G2 with Data > Data Validation > List so people cannot misspell it.

=$D5=$G$2

Result: TRUE

TRUE: G2 says Pending and so does D5, so Halden Hotels' row lights up. Change G2 to Shipped and rows 2 and 6 light up instead.

Highlight rows with missing information

COUNTBLANK across the row finds incomplete records. Lock the columns with $ and leave the row free, just like the single-cell rules.

Only include columns that must be filled. A2:E2 would also flag Copper Kettle, whose Notes cell is empty on purpose. Here =COUNTBLANK($A2:$B2)+COUNTBLANK($D2:$E2)>0 skips the Notes column.

=COUNTBLANK($A8:$E8)>0

Result: TRUE

TRUE for SO-5507, which has no customer name.

Common mistakes

The colors are one row off

The rule was written for a different active cell, for example when you selected from row 1 or from the bottom up. Open Manage Rules and make the formula refer to the first row of the Applies to range.

Only one column changes color

The $ is missing before the column letter. Use $D2, not D2.

The whole table lights up or nothing does

The row is locked too: $D$2. Remove the second $.

Rules multiply after inserting or copying rows

Excel can split a rule into many small Applies to ranges. In Manage Rules, delete the duplicates and set one range, such as =$A$2:$E$500.

FAQ

How do I highlight an entire row based on a cell value in Excel?

Select the rows, then Home > Conditional Formatting > New Rule > Use a formula, and enter a rule like =$D2="Cancelled". The $ before the column letter makes every cell in the row test the same column.

How do I highlight a row if a cell contains certain text?

Use =ISNUMBER(SEARCH("text",$C2)) as the rule. SEARCH finds the text anywhere in the cell and ignores case.

Why does my conditional formatting only color one cell?

You either selected only one column before creating the rule, or the column reference has no $. Select the full rows and use $D2.

Can I highlight rows based on a drop-down selection?

Yes. Put the drop-down in a cell like G2 and use =$D2=$G$2 as the rule. Changing the drop-down changes which rows are colored.

Functions used

Related guides

Updated