Highlight Cells That Contain Specific Text
By ExcelReady TeamUpdated 6 min read
The short answer
Select the cells, then go to Home > Conditional Formatting > Highlight Cells Rules > Text that Contains. Type the word, pick a colour and click OK. The rule ignores capitals and matches the word anywhere in the cell. To colour the whole row, or to make the match case-sensitive, use a formula rule such as =ISNUMBER(SEARCH("delayed",$C2)).
Key takeaways
- Text that Contains is the fastest way: Home > Conditional Formatting > Highlight Cells Rules > Text that Contains.
- For a whole row, use a formula rule: =ISNUMBER(SEARCH("delayed",$C2)), with $ before the column only.
- SEARCH ignores capitals. Swap in FIND when the case must match exactly.
- Point the rule at an input cell, like $G$1, to change the highlighted word without editing the rule.
On this page+
To highlight cells containing text in Excel, use conditional formatting: select the range, choose Text that Contains, type the word and pick a colour. When you need more control, such as colouring the whole row or matching capitals exactly, a short formula rule with ISNUMBER and SEARCH does the job. This guide shows both on one small order list, so you can spot problem rows at a glance.
The sample data#
All the examples use this order list in A1:C7. The goal is to make every order with "delayed" in its note stand out.
| A | B | C | |
|---|---|---|---|
| 1 | Order | Customer | Status note |
| 2 | O-101 | Lena | Delivered |
| 3 | O-102 | Omar | Delayed at customs |
| 4 | O-103 | Priya | Out for delivery |
| 5 | O-104 | Tom | delayed - weather |
| 6 | O-105 | Ana | Delivered |
| 7 | O-106 | Ken | Address problem, delayed |
Three notes contain the word: rows 3, 5 and 7. Notice the mix of capitals and the word sitting at the start, middle or end of the text. A good rule has to catch all three.
How to highlight cells containing text with Text that Contains#
The built-in Text that Contains rule is the quickest method and needs no formula. It works the same way on Windows and Mac.
- Select C2:C7.
- Go to Home > Conditional Formatting > Highlight Cells Rules > Text that Contains.
- Type
delayedin the box. - Pick a format from the list, such as Light Red Fill with Dark Red Text, and click OK.
Excel colours C3, C5 and C7. The rule is not case-sensitive, so "Delayed" and "delayed" both match. It also matches part of a word: a search for deliver would colour both "Delivered" and "Out for delivery". Pick a search word that is specific enough.
You can also type a cell address instead of a word. Click in the box and then click a cell, such as G1. Excel stores it as =$G$1, and the highlight follows whatever you type in G1.
How to highlight cells with a formula rule#
A formula rule gives you full control. You write a test that returns TRUE or FALSE for the top-left cell, and Excel applies it to every cell in the range.
- Select C2:C7.
- Go to Home > Conditional Formatting > New Rule.
- Choose Use a formula to determine which cells to format.
- Enter the formula below, click Format, choose a fill colour and click OK twice.
=ISNUMBER(SEARCH("delayed",C2))Here is what each part does:
- SEARCH("delayed",C2) looks for the word inside C2. If it finds it, it returns the position as a number: in C3 it returns 1. If not, it returns a #VALUE! error.
- ISNUMBER(...) turns that into TRUE (a number came back) or FALSE (an error came back).
Conditional formatting colours every cell where the formula is TRUE. Write the formula for the first row only (C2) and leave out the $ before the row number, so Excel moves it down to C3, C4 and so on. The SEARCH function guide explains its arguments, and the article on ISNUMBER and SEARCH covers this pair in more depth.
How to highlight the whole row#
To colour the entire row, select all the data and lock the column you check with a $.
- Select A2:C7 (not the header row).
- Add a new formula rule with:
=ISNUMBER(SEARCH("delayed",$C2))The $ before C keeps every cell in the row looking at column C. Without it, the cell in column A would check column A, and the row would be only partly coloured. The row number stays relative, so row 5 checks C5. The guide to highlighting a whole row based on a cell value explains this $ pattern step by step.
How to make the highlight case-sensitive#
Use FIND instead of SEARCH when capitals matter. FIND works the same way but only matches the exact case.
=ISNUMBER(FIND("Delayed",C2))With this rule, only C3 ("Delayed at customs") is coloured. C5 and C7 use a lower-case "delayed", so FIND returns an error and the cell stays plain. Text that Contains has no case-sensitive option, so a formula rule is the only way.
Other text rules you can use#
The same pattern answers many "highlight if" questions. Swap the formula in the rule:
| Goal | Formula rule (for C2) |
|---|---|
| Contains "delayed" (any case) | =ISNUMBER(SEARCH("delayed",C2)) |
| Contains "Delayed" (exact case) | =ISNUMBER(FIND("Delayed",C2)) |
| Contains "delayed" or "problem" | =OR(ISNUMBER(SEARCH("delayed",C2)),ISNUMBER(SEARCH("problem",C2))) |
| Does not contain "delayed" | =NOT(ISNUMBER(SEARCH("delayed",C2))) |
| Starts with "Delivered" | =LEFT(C2,9)="Delivered" |
| Contains the word typed in G1 | =AND($G$1<>"",ISNUMBER(SEARCH($G$1,C2))) |
| Holds any text at all | =ISTEXT(C2) |
The G1 version is a handy search box: type a word in G1 and matching cells light up. The $G$1<>"" part matters, because SEARCH("",C2) returns 1 for every cell, so an empty G1 would colour the whole range.
If you want to count the matches rather than colour them, see how to count cells with text. To pull the matching rows into a new list, see how to FILTER rows that contain text. And for repeated values rather than a specific word, highlighting duplicates uses a similar rule.
Why isn't my highlight working?#
When nothing is coloured, or the wrong cells are, the cause is usually one of these:
- The formula points at the wrong row. The formula must refer to the first row of the selected range. If you selected A2:C7 but wrote
$C3, every highlight shifts down one row. - A
$in the wrong place.$C$2locks the row too, so every row checks C2 only. Use$C2for rows and plainC2for single cells. - A stray space in the search word.
"delayed "with a trailing space won't match C7, where "delayed" is the last word. Check the word you typed in the rule or the input cell. - An empty search cell. A rule that points at an empty cell matches everything. Add the
AND($G$1<>"",...)check. - Another rule wins. Open Home > Conditional Formatting > Manage Rules to see every rule on the sheet, their order and the range each one applies to. Fix or delete old rules you don't need.
Practise it#
Try the exercise on this page first: test the rule in a cell before you add it, which is a good habit for any formula rule. Then practise conditional formatting in a live spreadsheet, where you build highlight rules and see them apply, and practise FIND and SEARCH to get comfortable with the text tests these rules depend on.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Test the rule before you add it. In D3, check whether the note in C3 contains the word delayed, using ISNUMBER and SEARCH, then press Enter.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Delayed? | ||||
| 2 | Delivered | ||||
| 3 | Delayed at customs | ||||
| 4 | Out for delivery | ||||
| 5 | delayed - weather | ||||
| 6 | Delivered | ||||
| 7 | Address problem, delayed | ||||
| 8 | |||||
| 9 | |||||
| 10 |
Tip: SEARCH("delayed",C3) returns a position number if the word is there. ISNUMBER turns that into TRUE.
Practise this in a lesson
Frequently asked questions
How do I highlight cells that contain a certain word in Excel?
Select the range and choose Home > Conditional Formatting > Highlight Cells Rules > Text that Contains. Type the word, choose a format and click OK. Every cell with that word anywhere in it is coloured.
Is Text that Contains case-sensitive?
No. It treats Delayed, delayed and DELAYED the same. For a case-sensitive match, use a formula rule with FIND, such as =ISNUMBER(FIND("Delayed",C2)).
How do I highlight the entire row if a cell contains text?
Select the whole table without headers, add a New Rule with Use a formula to determine which cells to format, and enter =ISNUMBER(SEARCH("delayed",$C2)). The $ locks the column so every cell in the row checks column C.
How do I highlight cells that contain any text at all?
Use a formula rule with ISTEXT, such as =ISTEXT(A2). It colours cells that hold text and leaves numbers, dates and empty cells alone.
Can I highlight cells that contain one of several words?
Yes. Use OR in a formula rule: =OR(ISNUMBER(SEARCH("delayed",C2)),ISNUMBER(SEARCH("problem",C2))). The cell is coloured if either word appears.