In this example, the goal is to sum the Quantity in C5:C16 when the Item in B5:B16 ends with "small". To solve this problem, you can use either the SUMIFS function or the SUMIF function with the asterisk (*) wildcard, as explained below.
Certain Excel functions like SUMIFS and SUMIF support the wildcard characters "?" (any one character) and "*" (zero or more characters), which can be used in criteria. These wildcards allow you to create criteria such as "begins with", "ends with", "contains 3 characters", etc. as shown in the table below:
|Cells with 3 characters||"???"|
|Cells like "bed", "bad", "bid", etc||"b?d"|
|Cells that begin with "xyz"||"xyz*"|
|Cells that end with "xyz"||"*xyz"|
Note that wildcards are enclosed in double quotes ("") when they appear in criteria.
The generic syntax for the SUMIFS function with a single condition looks like this:
Notice that the sum range always comes first in the SUMIFS function. To use SUMIFS to sum the Quantity in C5:C16 when the Item in B5:B16 ends with "small", the formula in F5 looks like this:
The criteria "*small" means match text that ends with "small". Notice both the text and the wildcard must be enclosed in double quotes (""). Also note that SUMIFS is not case-sensitive. The criteria "*small" will match "Small", "SMALL", or "small".
You can also solve this problem with the SUMIF function, an older function in Excel that supports just one condition. The generic syntax for the SUMIF function looks like this:
Notice sum_range comes last in the SUMIF function. To sum the Quantity in C5:C16 when the Item in B5:B16 ends with "small", the equivalent SUMIF formula is:
Like the SUMIFS function, the SUMIF function is not case-sensitive.