Home  /  Blog  /  Logical & Conditional
Logical & Conditional

Highlight Row in Excel — With Examples (Conditional Formatting by Cell Value)

By admin 1 December 2026 Logical & Conditional

You have a table of orders and you want every Pending row to turn yellow — the whole row, not just the Status cell. Regular conditional formatting will not do it: it looks at each cell on its own, so it colours that one cell and leaves the rest of the row alone. The fix is one formula with one dollar sign: =$E2="Pending". The dollar locks the column, so every cell in a row reads the same Status cell, and the row number moves down as Excel works through the table. This guide gives you that rule first, then runs it on the ten-order sales table, so you can count which rows highlight — for text, numbers, dates, contains-text, blank cells and two conditions — plus the two reasons only one cell highlights, and the honest answer about cell colour.

Quick takeaway: lock the column, not the row.

  • Select the whole data range (not the headers), Home → Conditional Formatting → New Rule → “Use a formula to determine which cells to format”.
  • =$E2="Pending" — the $ locks column E, the row number moves down.
  • Excel runs the formula once per cell; TRUE colours the cell, FALSE leaves it alone.
  • Only one cell highlighted? The rule was applied to one column, or the column was not locked.
  • A formula cannot read a cell’s colour — use the value that made the colour.
Highlight Row in Excel — With Examples (Conditional Formatting by Cell Value)

The Rule — Six Steps

  1. Select the entire data range — A2:F11 in the table below — but not the header row.
  2. On the Home tab, in the Styles group, click Conditional Formatting, then New Rule.
  3. Click “Use a formula to determine which cells to format”.
  4. Enter the formula — for example, =$E2="Pending".
  5. Click Format, go to the Fill tab, and pick the colour.
  6. Click OK, then OK again.

Every row where the Status is Pending is now highlighted — the whole row, all six columns.

Why It Works — The Dollar Sign

Conditional formatting runs the formula once for every cell in the range you selected, and colours the cell whenever the result is TRUE. The whole trick is the dollar sign in =$E2="Pending". It locks the column to E, so every cell in a row looks at the Status cell in that same row. When Excel checks cell A2, it reads E2. When it checks F2, it still reads E2. All six cells in row 2 get the same answer, which is why the entire row is coloured. The row number has no dollar sign, so it moves down as Excel works through the range: cells in row 3 read E3, cells in row 4 read E4, and so on.

Reference in the ruleWhat is lockedWhat each cell is tested againstUse it for
E2NothingThe cell in the same relative position, so each cell tests itselfHighlighting only the cells that fail
$E2The columnColumn E of the cell’s own rowHighlighting the whole row when a value in column E qualifies
E$2The rowRow 2 of the cell’s own columnHighlighting a whole column
$E$2Column and rowOne fixed cell, the same for every cellA target or drop-down cell that drives the rule

The Worked Table — Ten Orders, Six Rules

Every example below uses the same ten-order sales table from the COUNTIF and SUMIF articles — Rep, Region, Sales, Order Date, Status, Notes — in rows 2 to 11. Every highlighted row was counted against it.

RuleFormulaRows highlightedCount
Status is Pending=$E2="Pending"3, 6, 8, 104
Region is East=$B2="East"2, 4, 7, 84
Sales over $1,000=$C2>10002, 4, 6, 9, 115
Date is past due=$D2<TODAY()2, 3, 4, 5, 6, 7, 8, 9, 109
Notes contain Rush=ISNUMBER(SEARCH("Rush", $F2))2, 7, 113
Notes are blank=$F2=""3, 6, 8, 104
Paid AND over $1,000=AND($E2="Paid", $C2>1000)2, 4, 9, 114
East OR over $2,000=OR($B2="East", $C2>2000)2, 4, 7, 84

Read the rows. The past-due rule highlights 9 of the 10 orders as of 24 November 2026 — only row 11, dated 1 December, is still in the future. The East rule highlights 4 rows, and one of them is Jordan’s row, where the region is written “east” in lowercase — the = comparison ignores case, so “east” matches “East”. And the blank-notes rule highlights the same 4 rows as the Pending rule — the same four orders have no note — which is how you know the two rules are reading the same table.

Highlight a Row If a Cell Contains Text

An exact match is =$E2="Pending". A contains match needs SEARCH, because = only matches the whole cell. SEARCH returns a position when the text is found and an error when it is not — and ISNUMBER turns that into TRUE or FALSE:

=ISNUMBER(SEARCH("Rush", $F2))

On the table that highlights rows 2, 7 and 11 — the three orders with “Rush” in the Notes. SEARCH ignores case, so “rush” would match “Rush”. Use FIND instead of SEARCH when the case must match exactly.

Highlight a Row If a Date Is Past Due

A date is a number, so the rule is a comparison against TODAY():

=$D2<TODAY()

As of 24 November 2026 that highlights 9 rows — every order dated before today. Add a second condition for the ones that are still open: =AND($D2<TODAY(), $E2="Pending") highlights only the past-due orders that are still Pending — rows 3, 6, 8 and 10, the same four Pending rows, because all four are already past due.

Highlight a Row If a Cell Is Y — “If Y Then Green”

The keyword “if y then green” is the same rule with a Y/N column: a column holding Y or N, and the rule =$B2="Y" with a green fill. The formula is the same pattern as every other rule in this article — the trigger cell, locked by column, compared to a value. And the same warning applies: the value must match exactly. “Y” is not “Yes”, and a trailing space — “Y ” — is not “Y” either. If the rule highlights nothing, check the value first: select the cell, look at the formula bar, and check for a space at the end.

Highlight a Row If a Cell Is Not Blank

=NOT(ISBLANK($F2))

That highlights the 6 rows with a note. The opposite — blank cells — is =$F2="", which highlights the 4 rows with no note. And the same pattern with ISBLANK: =ISBLANK($F2) gives the same 4 rows. Use ="" when the cell might hold a formula returning “”, because ISBLANK only counts a truly empty cell.

Why Only One Cell Highlights — The Two Causes

This is the single most common failure, and there are only two causes.

CauseWhat happenedFix
The rule was applied to one columnOnly column E was selected when the rule was created, so Excel only ever formats column EDelete the rule, select the whole range A2:F11, and create it again
The column was not lockedThe formula was =E2="Pending" instead of =$E2="Pending", so the reference slides sideways as Excel works across the rangeAdd the $ before the column letter: =$E2="Pending"

And one more: if the rule highlights the wrong rows, check the active cell. The formula is written for the top-left cell of the selection — if you selected the range from the bottom up, or with a different cell active, the whole grid of results slides. Select from the top-left, with the first data row active, and create the rule again.

Can a Formula Read a Cell’s Colour? — The Honest Answer

No. There is no worksheet formula that returns a cell’s fill colour, and conditional formatting cannot test one. The two keywords in this group that ask for it — “excel formula based on cell color” and “excel formula using cell color” — have no formula answer. What you can do instead is test the value that caused the colour: if a cell is yellow because its status is Pending, write the rule on the status — =$E2="Pending" — not on the colour. The colour is the result of a rule, not a value a formula can read.

Common Mistakes

MistakeWhat happensFix
You locked the row as well as the column=$E$2="Pending" tests every row against row 2 — either all rows highlight or none doLock only the column: =$E2="Pending"
You locked nothing=E2="Pending" slides sideways — only one column highlightsLock the column: =$E2="Pending"
You included the header row in the rangeThe header highlights too, or the rule is off by one rowSelect from the first data row, not row 1
You wrote the formula for the wrong rowThe rule highlights the row below, or nothing at allThe formula must use the first row of the selection
You used = for a contains match=$F2="Rush" matches only a cell that is exactly “Rush”Use =ISNUMBER(SEARCH("Rush", $F2))
You compared a number to text=$C2="1000" never matches — 1000 is a number, “1000” is textCompare numbers without quotes: =$C2>1000
You tried to test a colourNo formula reads a fill colourTest the value that caused the colour

Frequently Asked Questions

How do I highlight an entire row based on a cell value in Excel? Select the whole data range, Home → Conditional Formatting → New Rule → “Use a formula to determine which cells to format”, and enter a formula with the column locked, for example =$E2="Pending". Pick a fill colour and click OK twice.

Why does only one cell highlight instead of the whole row? Either the rule was applied to one column instead of the whole range, or the column was not locked — =E2="Pending" instead of =$E2="Pending". Fix the selection or add the $.

What does the $ do in the conditional formatting formula? It locks the column, so every cell in a row reads the same trigger cell. Without it, the reference slides sideways as Excel works across the range. The row number has no $, so it moves down as Excel works through the table.

How do I highlight a row if a cell contains specific text? =ISNUMBER(SEARCH("Rush", $F2)) — SEARCH finds the text anywhere in the cell, and ISNUMBER turns the result into TRUE or FALSE.

How do I highlight a row if a date is past due? =$D2<TODAY() — the date is a number, so a comparison against TODAY() works. As of 24 November 2026 that highlights 9 of the 10 orders in the table.

How do I highlight a row if a cell is not blank? =NOT(ISBLANK($F2)) — or =$F2<>"", which also catches a formula returning “”.

Can I highlight a row based on a cell’s colour? No — no worksheet formula returns a cell’s fill colour. Test the value that caused the colour instead.

That is how to highlight a row in Excel based on a cell value: select the whole range, write a formula rule, and lock the column — =$E2="Pending" — so every cell in a row reads the same trigger cell while the row number moves down. On the ten orders in this guide, that one pattern answers every question: Pending highlights 4 rows, East highlights 4, sales over $1,000 highlights 5, past due highlights 9 as of 24 November 2026, and “Rush” in the Notes highlights 3. Remember the two things that catch everyone once: if only one cell highlights, the rule was applied to one column or the column was not locked — and if you want to highlight by colour, you cannot, because no formula reads a fill colour; test the value that made the colour instead. From here, the next functions worth learning are the ones this one sits next to — the IF formula for the logic inside the rule, the COUNTIF formula for counting the rows that would highlight — and the full learning order for the whole site is on the Excel Formulas hub and the Logical & Conditional category page.


About admin

Author of Excel formula guides on this blog.

View all guides by admin →

Keep Learning

Related guides