If Cell Contains Text — With Examples (SEARCH, FIND, COUNTIF Wildcards)
Learn the Excel formula for if a cell contains specific text: ISNUMBER with SEARCH, FIND for case, and COUNTIF wildcards.
Read Guide →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.
=$E2="Pending" — the $ locks column E, the row number moves down.
=$E2="Pending".Every row where the Status is Pending is now highlighted — the whole row, all six columns.
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 rule | What is locked | What each cell is tested against | Use it for |
|---|---|---|---|
E2 | Nothing | The cell in the same relative position, so each cell tests itself | Highlighting only the cells that fail |
$E2 | The column | Column E of the cell’s own row | Highlighting the whole row when a value in column E qualifies |
E$2 | The row | Row 2 of the cell’s own column | Highlighting a whole column |
$E$2 | Column and row | One fixed cell, the same for every cell | A target or drop-down cell that drives the rule |
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.
| Rule | Formula | Rows highlighted | Count |
|---|---|---|---|
| Status is Pending | =$E2="Pending" | 3, 6, 8, 10 | 4 |
| Region is East | =$B2="East" | 2, 4, 7, 8 | 4 |
| Sales over $1,000 | =$C2>1000 | 2, 4, 6, 9, 11 | 5 |
| Date is past due | =$D2<TODAY() | 2, 3, 4, 5, 6, 7, 8, 9, 10 | 9 |
| Notes contain Rush | =ISNUMBER(SEARCH("Rush", $F2)) | 2, 7, 11 | 3 |
| Notes are blank | =$F2="" | 3, 6, 8, 10 | 4 |
| Paid AND over $1,000 | =AND($E2="Paid", $C2>1000) | 2, 4, 9, 11 | 4 |
| East OR over $2,000 | =OR($B2="East", $C2>2000) | 2, 4, 7, 8 | 4 |
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.
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.
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.
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.
=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.
This is the single most common failure, and there are only two causes.
| Cause | What happened | Fix |
|---|---|---|
| The rule was applied to one column | Only column E was selected when the rule was created, so Excel only ever formats column E | Delete the rule, select the whole range A2:F11, and create it again |
| The column was not locked | The formula was =E2="Pending" instead of =$E2="Pending", so the reference slides sideways as Excel works across the range | Add 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.
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.
| Mistake | What happens | Fix |
|---|---|---|
| You locked the row as well as the column | =$E$2="Pending" tests every row against row 2 — either all rows highlight or none do | Lock only the column: =$E2="Pending" |
| You locked nothing | =E2="Pending" slides sideways — only one column highlights | Lock the column: =$E2="Pending" |
| You included the header row in the range | The header highlights too, or the rule is off by one row | Select from the first data row, not row 1 |
| You wrote the formula for the wrong row | The rule highlights the row below, or nothing at all | The 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 text | Compare numbers without quotes: =$C2>1000 |
| You tried to test a colour | No formula reads a fill colour | Test the value that caused the colour |
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.
Learn the Excel formula for if a cell contains specific text: ISNUMBER with SEARCH, FIND for case, and COUNTIF wildcards.
Read Guide →Learn the IF formula in Excel: one condition, nested IF, IF with AND and OR, and IFS — with worked examples on...
Read Guide →Learn the SUMIF formula in Excel: sum values by text, number, date or wildcard, with worked examples — plus SUMIFS for two...
Read Guide →