Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Highlighting Cells Containing Specific Text.

Highlighting Cells Containing Specific Text

by Allen Wyatt
(last updated June 2, 2017)

25

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:

  1. Select the range of cells.
  2. Choose Conditional Formatting from the Format menu. Excel displays the Conditional Formatting dialog box.
  3. In the drop-down Condition list, choose "Formula Is". (See Figure 1.)
  4. Figure 1. The Conditional Formatting dialog box.

  5. In the formula box, enter the following formula. (Make sure you replace A1 with the cell address of the cell in the upper-left corner of the range selected in step 1.)
  6.      =NOT(ISERR(SEARCH("shawn",A1)))
    
  7. Click on Format. Excel displays the Format Cells dialog box. (See Figure 2.)
  8. Figure 2. The Format Cells dialog box.

  9. 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.
  10. Click on OK to close the Format Cells dialog box.
  11. Click on OK to close the Conditional Formatting dialog box.

You can make this approach even more general-purpose in nature by specifying a cell that contains what you want to search for. For instance, if you type "shawn" in cell F7, then you could replace the formula in step 4 with the following:

=NOT(ISERR(SEARCH($F$7,A1)))

Now, you can search for something different just by changing the characters in cell F7.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2671) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Highlighting Cells Containing Specific Text.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Default Font for Page Numbers

Page numbers are a common addition to documents, and a great aid to readers. If you want to easily format page numbers, you ...

Discover More

Adding Tabs at the Beginning of a Line

Press a tab at the beginning of a paragraph, and Word normally assumes you want to indent the paragraph. If you don't like ...

Discover More

Unwanted Read-Only Workbook Status

Once a workbook assumes a "read-only" status, it can be a real pain to get that status removed. This tip explains why and ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Shading a Cell Until Something is Entered

Conditional formatting provides the opportunity to get very creative with your formatting. One such creative urge can be ...

Discover More

Conditional Formatting with Data Imported from Access

If you want to apply a conditional format to data imported into Excel from Access, you may run into some difficulties related ...

Discover More

Conditional Format that Checks for Data Type

Conditional formatting can be used to highlight cells that contain the improper type of data for your needs. This tip ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 4 + 2?

2016-04-07 17:22:55

Phyllis Hawkins

every time I type a specific word in a specific cell using Excel 2013 it is replaced with different word. This happens with EVERY NEW document opened.

EX: in cell B1; the word "Title" is typed and then hit enter. The word automatically changes to "Executive Director". I have checked the backstage option in AutoCorrect and this is not listed.


2015-11-05 16:25:45

Leah

Hello,

How do I highlight columns C-F if A contains "Site Identified"? Not if A equals "Site Identified", I am aware of how to do that. Thank you!

Leah


2015-07-29 18:01:10

pol

Instead of highlighting, is it possible to ask for a password when a certain word is typed? Example I don't like the word "apple" in my file so whenever I type apple, a prompt will come up asking for an override password. Thanks for the help :)


2015-06-20 06:15:58

Shail

I want to automatic display "Insert rate" in blank cells backgroun, can it is possible


2015-06-06 03:49:59

swap

i want to highlight the cell e.g A9
and specified text look up area is B9 to Z9

is their any rule to do it.


2015-05-12 17:53:45

DavidMD

I have two sheets in a workbook.Sheet1 has a list of potential numbers in column B. Sheet2 is a list of numbers used listed in column B, a description in column C, a city in column D, Size in E, Color in F and Priority in G. I used VLOOKUP to populate Sheet1 B with the dscription from column B matching number in Sheet2.... =IFERROR(VLOOKUP(B5,'Sheet2'!B:C,2,0),"").
I would like to high-light the descriptions of the high priority items red, and lower priority yellow. How can I Highlight a field... if Sheet1 B2 = 1234 and Sheet2 number 1234 column F = High Priority, highligh Sheet1 B2 Red?


2015-03-26 08:36:18

Willy Vanhaelen

@Saoud
The formula to use is: =Left(A1,1)="7"

This works with numeric data as well as text.


2015-03-26 04:46:28

Saoud

Hi there,

I want to apply conditional formatting for cells (in column A) where the first number is 7. Can you please advise how to do that?


2015-03-21 06:08:38

Michael (Micky) Avidan

Btw, I warmly recommend that you check the new feature of CF as per partially/specific text - new feature in "Excel 2007" and above:
http://excelribbon.tips.net/T006235_Highlighting_Cells_Containing_Specific_Text.html
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2015-03-21 06:00:46

Michael (Micky) Avidan

@TO WHOM IT MAY CONCERN.
1) To my opinion, Allen's formula is the most suitable because it is not Case sensitive (all strings can be typed in Upper/Lower characters).
2) However, his suggested CF formula can be considerable shorter because the ISERROR check is not needed because any mismatching will result as: #VALUE! which will NOT trigger the CF.
Any match (regardless its position within the text) will end up with a positive number. Any positive number will be interpreted, by the CF rule, as TRUE.
This is the CF formula I have in mind: =FIND(F7,A7)
I hope I made myself clear.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2015-03-20 06:22:12

Willy Vanhaelen

@Dave
@Barbara

If your data is in column A this formula should do:

=FIND("your text",LOWER(A1))

Note that "your text" should be lower case.


2015-03-19 07:37:42

dave

Hi< I was wanting to do the same as Barbara posted on 21st jan; that is highlight cells that contain a text string that will also contain other text


2015-03-17 06:45:54

Willy Vanhaelen

@David
Supposing your data are in column B, this formula should do:
=OR(B1="y",B1="n",B1="o")


2015-03-16 15:17:23

david

Im looking for a way to highlight cells if the contain a y or n or o.

thank you


2015-02-08 05:52:40

Willy Vanhaelen

@Deb
See to it that there are no dollar sings ($)in the formula.

So it should be: =AND(B1<>"Yes",B1<>"Disabled")


2015-02-07 12:02:58

Deb

@Willy:
Thanks for your help
I used it, but its working properly.
Even if there are any other values in the column or blanks, its all getting formatted based on what value I am having on the first cell (B1).
If I am changing the values in the B1 cell, all the cells in the column are also effected.
Does it has something related to chaging the cell value or cell selection range? Can you please help?


2015-02-02 05:32:59

Willy Vanhaelen

@Deb
If those data are in column B, highlight that column.
The formula to enter in the conditional format dialog is:
=AND(B1<>"Yes",B1<>"Disabled")


2015-02-01 06:05:47

Deb

I have data in a column for 1000 cells. There is 6 types of data.They are - Yes, No, Disabled, Enabled, -, 0. There may be blank cells also in between. Those cells not containing Yes or Disabled, should be highlighted with some colour. I am not able to find a suitable formula to use for conditional formatting these cells in the column. Can anyone please help?


2015-01-30 16:04:19

B Gomez

It was very helpful! Thank you very much :)


2015-01-21 15:52:34

Barbara

Hi...I am trying to use Cond Formatting for cells that contain a specific word...possibly embedded within other text. Is this possible?


2013-12-16 19:04:23

Steve

Hey,

Thanks for this. Using 2003 things take a little more 'thought' and I was trying to do the above via COUNTIF but couldn't get it to be specific enough on the search so it was highlighting every cell.

This worked first time.

Thanks


2013-02-07 06:12:15

Barry Fitzpatrick

Buddy,

I don't know if you've resolved this yet.

Select the range A3:A2000 then put the formula:

=NOT(ISNA(MATCH(A3,$P$3:$P$200,0)))

as the Conditional Formatting "Formula Is" (Excel 2003) or "Use a formula to determine which cells to format" in Excel 2010, then setting the desired format to highlight the matching values.

This works by seeing if each cell in the range A3 to A2000 matches a cell value in P3 to P200 using the MATCH function. If there is a match the function return a value corresponding to the position of the matched value in the P3:P200 range; if no match it return #N/A. The ISNA function looks for this which would give a TRUE if the MATCH function returns #N/A, the NOT turns this into a FALSE so that the conditional format is invoked by matching value.


2013-02-06 18:36:42

Barbara

Wow! Great way of thinking and very easy to apply.


2012-05-22 20:54:23

Becky

Fantastic tip. Exactly what I needed and very easy to follow. Thanks!


2012-02-13 01:53:55

buddy bandol

hi please help me to solve on how will i use highlighting for ex. i have data on a cell a3 up a2000 i want that data will be highlighted if i put same data on a cell p3 upto p200. is it posible?


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.