This formula sums the quantity in column C when the text in column B contains “hoodie”. Note that SUMIFS is not case-sensitive. However, see below for a case-sensitive option. Note: this example embeds wildcards together with the search substring to keep things simple. However, you can also use wildcards with text in another cell, as explained in this more advanced example.


Excel functions like SUMIF and SUMIFS support the wildcard characters “?” (any one character) and “” (zero or more characters), which can be used in criteria. Wildcards allow you to create criteria to target cells that “begin with”, “end with”, “contain 3 characters” and so on. The table below shows some examples. For this problem, we want to use the “Cells that contain text in xyz” pattern, which uses two asterisks (), one before and one after the search string like this “xyz”. Note that wildcards are enclosed in double quotes ("") when they appear in criteria.

SUMIFS solution

One way to solve this problem is with the SUMIFS function. SUMIFS can handle multiple criteria, and the generic syntax for a single condition looks like this: Notice that the sum range always comes first in the SUMIFS function. In our case, the sum_range is C5:C16, criteria_range1 is B5:B16, and criteria1 is “hoodie”. Putting it all together, the formula in cell F5 of the worksheet shown is: Notice the text and both wildcards (*) are enclosed in double quotes (""). The meaning of this criteria is to match the substring “hoodie” anywhere in a text string. When the formula is entered in cell F5, it returns 22, the total quantity of “hoodie” products in the data.

SUMIF solution

This problem can also be solved with the SUMIF function, where the equivalent formula is: Note that sum_range is the last argument in the SUMIF function. However, the criteria itself is identical to what we used in SUMIFS above. The result returned by SUMIF is also the same: 22.

Case-sensitive option

As mentioned above, the SUMIF and SUMIFS functions are not case-sensitive. If you need a case-sensitive solution, you can use a formula based on the SUMPRODUCT function and the FIND function like this: Inside SUMPRODUCT, the left side of the expression tests for “Hoodie” with ISNUMBER and FIND: Note the “H” in hoodie is capitalized. The FIND function is always case-sensitive, and returns the position of find_text as a number when found, and a #VALUE! error when not found. We do not need to use a wildcard like (*) because FIND automatically searches for a substring. Because there are 12 values in B5:B16, FIND returns an array of 12 results like this: Notice that FIND returns numbers for rows 1, 9, 11, and 12 in the data. These are the rows where the substring “Hoodie” appears in the text. Next, the ISNUMBER function converts the results from FIND into TRUE and FALSE values, and the double negative (–) converts the TRUE and FALSE values to 1s and 0s. Inside SUMPRODUCT we now have: Note: technically, the double negative (–) is unnecessary in this formula, because multiplying the TRUE and FALSE values by the numeric values in C5:C16 will automatically convert TRUE and FALSE values to 1s and 0s. However, the double negative does no harm and it makes the formula a bit easier to understand, because it indicates a Boolean operation. When the two arrays are multiplied together, the zeros in the first array work like a filter to “cancel out” the quantity for items that are not “Hoodies”. The result inside SUMPRODUCT is a single array like this: With only one array to process, SUMPRODUCT sums the array and returns 22 as a final result. For a more detailed explanation of FIND + ISNUMBER see this article. To adapt this formula to use text in cell references, see this example. Note: In Excel 365, you can replace SUMPRODUCT with the SUM function. To read more about this, see Why SUMPRODUCT?

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.