Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
All articles IF If cell contains

If cell contains

We can check IF A CELL CONTAINS a specific term in a set of data with a combination of the IF, SEARCH and ISNUMBER functions. We can apply this to copy specific text in another location. The steps below will walk through the process.

Figure 1 – Result of using the “if a cell contains” formula

General Formula

IF(ISNUMBER(SEARCH"abc",cell_num,[value_if_TRUE],[value_if_FALSE])

Formula

=IF(ISNUMBER(SEARCH("re",B5)),"Yes","No")

Setting up the Data

  • We will place the list of words in Cell B5 to Cell B8.
  • We will name Cell C3 as “Does this word contain “re”. This is what we wish to find from every cell

Figure 2- Setting up the Data

If a cell contains “re” display “Yes” or “No”

  • We will click on Cell C4 where we want the search result to be shown.
  • We will insert the formula: =IF(ISNUMBER(SEARCH("re",B5)),"Yes","No")
  • Now, we will press the Enter key.

Figure 3 – Cells containing “re” displays Yes or No

  • We will use the fill handle to copy the formula to the other cells to get the result

Figure 4 – Final result after using the fill handle tool

How to display text containing “re”

With the same data, if we want to display the cell text rather than “Yes” or “No”, then we will follow the process below:

  • We will click on Cell C5
  • We will insert the formula: =IF(ISNUMBER(SEARCH("re",B5)),B5,"")
  • If the cell contains “re”, then “Great” will be displayed. If it doesn’t contain “re”, then the output cell will remain empty

Figure 5 – Cells containing “re” displays the full term

Explanation

=IF(ISNUMBER(SEARCH("re",B5)),"Yes","No")

  • SEARCH Function

The SEARCH function checks Cell B5 if it contains “re.”

  • ISNUMBER function

The ISNUMBER function returns as Yes if the text is found and No if the text is not found.

  • IF function
    =IF(B5="re", "Yes", "No")

The IF function returns the result into the output cell based on the returned result of the ISNUMBER function.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

Did this post not answer your question?
Get a solution from connecting with the expert

Another blog reader asked this question today on Excelchat:

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc