Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • Convert text string to valid reference in Excel using Indirect function
  • Approximate match with multiple criteria in Excel
  • How to get address of named range in Excel
  • Basic INDEX MATCH approximate in Excel
  • How to use Excel TRANSPOSE Function

Data Analysis Examples

  • How to add Trendline to a chart in Excel
  • How to Create Area Chart in Excel
  • Conditional Formatting Icon Sets Examples in Excel
  • Add Outline to Data in Excel
  • Understanding Pivot Tables in Excel

Data Validation Examples

  • Excel Data validation must contain specific text
  • Prevent invalid data entering in specific cells
  • Excel Data validation must not contain
  • Excel Data validation don’t exceed total
  • Excel Data validation number multiple 100

How to check cell that contains specific text in Excel

by

To check if a cell contains specific text, you can use the SEARCH function together with the ISNUMBER function. In the generic version, substring is the specific text you are looking for, and text represents text in the cell you are testing.

Formula

=ISNUMBER(SEARCH(substring,text))

Explanation

 In the example shown, the formula in D5 is:

=ISNUMBER(SEARCH(C5,B5))

This formula returns TRUE if the substring is found, and FALSE if not.

Note: the SEARCH function will automatically find partial matches.

Worked Example:   Highlight cells that contain one of many in Excel

How the formula works

The SEARCH function returns the position of the search string when found, and the #VALUE! error if not found. We use this fact to test whether the search string is found by using the ISNUMBER function to “catch” valid numeric positions.

ISNUMBER returns TRUE for numbers and FALSE for anything else. So, if SEARCH finds the substring, it returns the position as a number, and ISNUMBER returns TRUE. If SEARCH doesn’t find the substring, it returns a #VALUE! error, which causes the ISNUMBER to return FALSE.

Worked Example:   How to extract substring in Excel

If cell contains

If you want to do something when a cell contains specific text, you can wrap the formula in an IF statement like this:

=IF(ISNUMBER(SEARCH(substring,text)), "Yes", "No")

Instead of returning TRUE or FALSE, the formula above, will return “Yes” if substring is found and “No” if not.

Worked Example:   How to count keywords in a range of cell

Case sensitive version

If you want this formula to be case-sensitive, you can replace the SEARCH function with the FIND function like so:

=ISNUMBER(FIND(substring,text))

With hardcoded search string

To test a cell for a single hardcoded substring, just enclose the text in double quotes. For example, to check A1 for the text “apple” use:

=ISNUMBER(SEARCH("apple",A1))

Post navigation

Previous Post:

How to check if cell contains some words but not others in Excel

Next Post:

How to generate series of dates increment by 1 year from a single start date in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • How to get page from URL in Excel
  • SUBSTITUTE function: Description, Usage, Syntax, Examples and Explanation
  • How to split text string at specific character in Excel
  • Remove text by position in a cell in Excel
  • Extract last name from full name — Manipulating NAMES in Excel
  • How to calculate most recent day of week in Excel
  • Convert Unix time stamp to Excel date
  • Add decimal minutes to time in Excel
  • How to calculate quarter from date in Excel
  • Basic overtime calculation formula in Excel
  • DURATION function: Description, Usage, Syntax, Examples and Explanation
  • AMORLINC function: Description, Usage, Syntax, Examples and Explanation
  • PMT, RATE, NPER, PV and FV Financial Functions in Excel
  • YIELDMAT function: Description, Usage, Syntax, Examples and Explanation
  • INTRATE function: Description, Usage, Syntax, Examples and Explanation
Acronyms, Abbreviations, Initialism & What They Stand For
© 2021 xlsoffice. All Rights Reserved | Teal Smiles