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.
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.
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}
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.
--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}.
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.
Remarks:
The formula =SUMPRODUCT(--ISNUMBER(SEARCH(things,text)))=COUNTA(things) is not exactly checking. See screenshot:
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
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

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, Edge and Firefox.
