If cell contains text then display in Excel

If you have a list of text strings in column A, and a row of keywords, now, you need to check if the keywords are appear in the text string. If the keywords appear in the cell, displaying it, if not, blank cell is displayed as following screenshot shown.


If cell contains text then display in Excel

To solve this task, you should use the SERACH, ISNUMBER and IF functions together. The generic syntax is:

=IF(ISNUMBER(SEARCH(substring,text)),substring,"")
  • substring: the word that you want to find if it appears in the text string.
  • text: the text string that you want to check from.

1. Please enter or copy the following formula into cell C2:

=IF(ISNUMBER(SEARCH(C$1,$A2)),C$1,"")

2. Then, drag the fill handle to right to display all the texts which appear in the cell A2 based on the corresponding row data, see screenshot:

3. Keep on dragging the fill handle down to the cells that you want to apply this formula, and you will get the result as below screenshot shown:


Explanation of the formula:
  • SEARCH(C$1,$A2): the SEARCH function is used to check if the searched value in C1 is appears in A2, if the search string is found, the SEARCH will return the position (a number), if not found, an error value #VALUE! is returned.
  • ISNUMBER(SEARCH(C$1,$A2)): the ISNUMBER function will return TRUE if the search found, return FALSE if not found.
  • IF(ISNUMBER(SEARCH(C$1,$A2)),C$1,""): IF function is used to return the value of C1 if the ISNUMBER result is TRUE, the ISNUMBER result is FALSE, an empty string is returned.

Relative functions used:

  • SEARCH:
  • The SEARCH function can help you to find the position of a specific character or substring from the given text string.
  • IF:
  • The IF function is used to test for a specific condition, returns the corresponding value that you supply for TRUE or FALSE.
  • ISNUMBER:
  • The ISNUMBER function returns TRUE when a cell contains a number, and FALSE if not.

More articles:

  • Check If Cell Equals Any Value In List
  • For example, I have a list of text strings in column A, and now, I want to check if cell value in this column equals any value in another list of column E. If equals, display TRUE, otherwise, a FALSE value is displayed as below screenshot shown.
  • Check If A Cell Contains A Specific Text
  • Here the tutorial provides some formulas to check if a cell contains a specific text and return TRUE and FALSE as below screenshot shown, and explains the arguments and how the formulas works.

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.