Highlighting Cells Containing Specific Text
Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Highlighting Cells Containing Specific Text.
You can use the conditional formatting feature in Excel to help draw attention to cells that contain specific text in which you are interested. For instance, if you have a range of cells and you want to know which ones contain the letters "shawn," then you can do the following:
- Select the range of cells.
- With the Home tab of the ribbon displayed, click the Conditional Formatting option in the Styles group. Excel displays a palette of options related to conditional formatting.
- Choose New Rule. Excel displays the New Formatting Rule dialog box.
- In the Select a Rule Type area at the top of the dialog box, choose Format Only Cells that Contain.
- Using the left-most drop-down list in the criteria area, select Specific Text. (See Figure 1.)
Figure 1. The New Formatting Rule dialog box.
- Make sure the center drop-down list is Containing.
- In the right-most box enter "shawn" (without the quote marks).
- Click Format to display the Format Cells dialog box. (See Figure 2.)
Figure 2. The Format Cells dialog box.
- Using the controls in the dialog box, specify a format that you want used for those cells that contain the specified text. For instance, you may want bold text in a red typeface.
- Click OK to dismiss the Format Cells dialog box. The formatting you specified in step 9 should now appear in the preview area for the rule.
- Click OK.
There is a gotcha to be aware of when looking for specific text: The condtional formatting rule will consider the cell a match if it contains the text you specify in step 7 anywhere within the cell. So, for instance, if you use the text "shawn" in step 7, and the cell contains "My name is Shawn," then for the purpose of this type of format, this is a match.
The reason this works this way is because you specified "Containing" in step 6. If you want some other type of match, then you'll need to pick some different setting in step 6.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6235) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Highlighting Cells Containing Specific Text.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Leave your own comment:
Comments for this tip:
Reks 12 May 2016, 14:06
As someone asked below, i need to highlight the searched word withing a cell. Right now when i do the search and find option it just highlights the cell which has those words, but i want the actual word within the cell to get highlighted. Like it works in word doc, you search for word and every time that word appears in the doc it gets highlighted and it even gives the number of found words.... many thanks in advance for ur help.
Steve 12 May 2016, 06:41
As far as I'm aware you can't use arrays or ranges in conditional formatting, but you can work around it.
If you place your "trigger" numbers in a column you can use the following formula in the conditional formatting rule box
The "trigger" numbers are in Col F in this example - then if you need to change your "triggers" you only need to change the cells in Col F.
You can include a couple of blanks on the bottom of the list (if you include them in the formula).
Hope this is helps
Rich 11 May 2016, 12:03
pls, I need you to help me. I am trying to format cells based on certain values. The cells contain values 1 to 90. I want to give a unique color to cells containing the ff. values: 31, 47, 55, 59, 61, 62, 79 and 87. I know I can do them one after the other but I need a way to them all at once.
Thanks for your help.
Sulabh 25 Apr 2016, 08:09
Steve 23 Apr 2016, 06:03
You need to create 2 rules using "use formula to determine which cells to format" then use;
obviously change the cell address to the first cell in your range to be checked
sulabh 22 Apr 2016, 08:18
I was working on same case where I had to highlight cell color based on 2 texts -"Matching" and "Not Matching". I created 2 separate rules for both cases.Now if even the cell values in "Not Matching", I am getting cell color defined for "Matching". Please help.
Jody 15 Apr 2016, 02:38
I've actually realised that you can do this simply with a find and replace search.
You can format your replacement text also. This has done the job for me.
Jody 15 Apr 2016, 02:28
Hi.... I am interested in knowing if there was a response to Sivahari's question regarding highlighting/formatting the found text within the cell and not the entire cell. I need to do this if possible also.
Thanking you for your assistance.
David 12 Mar 2016, 03:17
Hira 18 Sep 2015, 02:24
Bintang 07 Sep 2015, 05:00
is it possible to make formula that search text only at the end of the sentence?
ex: Im gonna search Y in
and then im need to highlight those cell with Y
thanks in advance
Dave S 09 Mar 2015, 06:04
Yes, in macros you can reference cells in different workbooks, you just need to include the workbook and worksheet names in the cell reference. You can check the syntax using Record Macro - the reference to a cell in another workbook will be something like (if the workbooks are in the same folder):
If the workbooks are in different locations, the workbook reference will include the file path.
Leigh-Ann 09 Mar 2015, 01:46
Sivahari 07 Mar 2015, 06:08
Is there any possibility to highlight specific text in Excel worksheet without highlighting full cell and without using macros?
We need to highlight specific text only. not to cell.
Please provide your response.
rk 07 Mar 2015, 05:02
i want to use cells of two or more different sheets of different excel files in a macro. is itposbbile? then how?
Amjad Abuaysheh 07 Mar 2015, 04:58
Awesome. Thanks for your great tips :)