Log in  \/ 
x
or
x
x
Register  \/ 
x

or

Excel Formula: Check if cell contains all of many things

Supposing in Excel, there is a list of values in column E, you want to check if the cells in column B contain all of the values in column E, and return TRUE or FALSE as below screenshot shown. Here in this tutorial, it provides a formula to solve this task.
doc check if cell contain all of many things 1

Generic formula:

=SUMPRODUCT(--ISNUMBER(SEARCH(things,text)))=COUNTA(things)

Arguments

Things: the list of values that you want to use to check if argument text contains.
Text: the cell or text string you want to check if containing argument things.

Return value:

This formula returns logical value, FALSE: the cell does not contain all of things; TRUE:the cell contains all of things.

How this formula work

For instance, in column B, there is a list of text strings which you want to check if containing all values in the range E3:E5, please use below formula.

=SUMPRODUCT(--ISNUMBER(SEARCH($E$3:$E$5,B3)))=COUNTA($E$3:$E$5)

Press Enter key, drag fill handle over the cells which you want to check. FALSE indicates the cell does not contain all values in the range E3:E5, while TURE indicates the relative cell contains all the values.
doc check if cell contain all of many things 2

Explanation

SEARCH function: the SEARCH function will return the location of the first character of the text string inside another. If the SEARCH function finds the text, it returns the position, if not, it returns #VALUE! error. For instance, here the formula SEARCH($E$3:$E$5,B4) will search each value of the range E3:E5 in cell B4, and returns the location of each text string in the cell B4. It will return an array result as this: {1;7;12}
doc check if cell contain all of many things 3

ISNUMBER function: the ISNUMBER function will check whether a value is a number, and return TRUE o False. Here ISNUMBER(SEARCH($E$3:$E$5,B4)) will return array result as {true;true;true} as the SEARCH function finds 3 numbers.
doc check if cell contain all of many things 4

--ISNUMBER(SEARCH($E$3:$E$5,B4)) will convert the TRUE value to 1, and convert FALSE value to 0, so this formula changes the array result to {1;1;1}.
doc check if cell contain all of many things 5

SUMPRODUCT function: is used to multiples ranges or sum arrays together and returns the sum of products. The SUMPRODUCT(--ISNUMBER(SEARCH($E$3:$E$5,B4))) returns 1+1+1=3.

COUNTA function: returns the number of non-blank cells. COUNTA($E$3:$E$5) returns 3, so the result of SUMPRODUCT(--ISNUMBER(SEARCH($E$3:$E$5,B4))) is equal to 3, the whole formula will return TRUE, or return FALSE.
doc check if cell contain all of many things 6

Remarks:

The formula =SUMPRODUCT(--ISNUMBER(SEARCH(things,text)))=COUNTA(things) is not exactly checking. See screenshot:
doc check if cell contain all of many things 7

Sample File

doc sampleClick to download sample file


Relative Formulas

  • Count cells equal to
    With the COUNTIF function, you can count cells that equal to or not contain a specified value.
  • Count cells that equal to x or y
    In some times, you may want to count the number of cells that meet one of two criteria, in this case, you can use the COUNTIF function.
  • Count cells equal to x and y
    Here this article introduce the formula to count cells that at the meanwhile match two criteria.
  • Count cells not equal to
    This article talks about how to use the COUNTIF function to count the number of cell that not equal to a specific value

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
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.