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

Lookup and Reference Examples

  • Extract all partial matches in Excel
  • Excel Advanced Lookup using Index and Match Functions
  • How to get last row in text data in Excel
  • Count unique text values with criteria
  • INDEX function: Description, Usage, Syntax, Examples and Explanation

Data Analysis Examples

  • How to calculate current stock or inventory in Excel
  • Excel Bar Chart
  • Conflicting Multiple Conditional Formatting Rules in Excel
  • How to Create Thermometer Chart in Excel
  • How to combine 2 or more chart types in a single chart in Excel

Data Validation Examples

  • Excel Data validation must begin with
  • Excel Data validation date in specific year
  • Excel Data validation allow weekday only
  • Excel Data validation don’t exceed total
  • Excel Data validation with conditional list

How to check cell contains which things in Excel

by

If you have a list of things (words, substrings, etc) and want to find out which of these things appear in a cell, you can build a simple table and use a formula based on the SEARCH function.

Setup

Suppose you have a cells that contain text that mentions various colors, and you want to figure out which colors are mentioned in each cell.

With the text on the left, create a simple table with the cells you want to check on the left, and the words you want to look for as column labels to the right.

Worked Example:   Calculate total hours that fall between two times in Excel

See example below:

Formula

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

Note that the references in this formula are carefully constructed. The reference to C$4 has the row locked, and the reference to $B5 has the column locked. This allows the formula to be copied throughout the table and still work correctly.

Worked Example:   Even and Odd function in Excel

Explanation

In the example, we are checking for 6 colors, so the table has 7 columns total including the column we are searching within.

In the second column, add the first formula. In cell C5 of the example, we have:

=IF(ISNUMBER(SEARCH(C$4,$B5)),C$4,"")

How this formula works

This formula is based on the simpler formula described here. It uses the SEARCH function to look inside B5 for using cell C4 as the search string. If SEARCH returns a number, it means the search string was found. In that case, ISNUMBER will return TRUE, and the IF function will return the value in C4.

Worked Example:   Highlight cells that contain in Excel

If the search string isn’t found, SEARCH returns an error, ISNUMBER returns FALSE, and the IF function returns an empty string (“”) — the value if FALSE.

 

Post navigation

Previous Post:

How to display conditional message with REPT function in Excel

Next Post:

How to check cell equals one of many things 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 pad text to match equal length in Excel
  • How to convert numbers to text using TEXT function in Excel
  • Extract middle name from full name — Manipulating NAMES in Excel
  • Remove text by position in a cell in Excel
  • FIND, FINDB functions: Description, Usage, Syntax, Examples and Explanation
  • Convert time to time zone in Excel
  • Display Date is workday in Excel
  • NETWORKDAYS.INTL function: Description, Usage, Syntax, Examples and Explanation
  • Convert Excel time to decimal minutes
  • Extract date from a date and time in Excel
  • RRI function: Description, Usage, Syntax, Examples and Explanation
  • ACCRINTM function: Description, Usage, Syntax, Examples and Explanation
  • COUPDAYSNC function: Description, Usage, Syntax, Examples and Explanation
  • PMT function: Description, Usage, Syntax, Examples and Explanation
  • How to set check register balance in Excel
Acronyms, Abbreviations, Initialism & What They Stand For
© 2021 xlsoffice. All Rights Reserved | Teal Smiles