To check to see if a cell contains more than one substring, you can use a formula based on the COUNTIF function.

In the example shown, the formula in C5 is:


Generic formula



The core of this formula is COUNTIF, which returns zero if none of the substrings is found, and a positive number if at least one substring is found. The twist in this case is that we are giving COUNTIF more than one substring to look for in the criteria, supplied as an "array constant". As a result, COUNTIF will return an array of results, with one result per item in the original criteria.

Note that we are also using the asterisk (*) as a wildcard for zero or more characters on either side of the substrings. This is what allows COUNTIF to count the substrings anywhere in the text (i.e. this provides the "contains" behavior).

Because we are getting back an array from COUNTIF, we use the SUM function to sum all items in the array. The result goes into the IF function as the "logical test". Any positive number will be evaluated as TRUE, so you can supply any values you like for value if true and value if false.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.