Tom’s Tutorials For Excel: COUNTIF and SUMIF with wildcards
You can use wildcard characters with functions to return specific information. For example, the wildcard “?” character represents any single character. The wildard “*” character represents any count of characters.
To see wildacrds in action, suppose you have a list of varying length text in column A, such as the pictured serial numbers. To count how many serial numbers contain “06” as their fifth and sixth characters, the formula in cell E2 is =COUNTIF(A2:A10,"????06*")
.
Note that the three serial numbers meeting this criteria are in cells A2, A6, and A9.
To sum the numbers in column B that are on the same row as the serial numbers meeting this same criteria, the formula in cell E3 is =SUMIF(A2:A10,"????06*",B2:B10)
.
Thanks.