Yes, Google Sheets SUMIFS supports wildcards: use an asterisk (*) to match any sequence of characters, a question mark (?) to match any single character, and a tilde (~) to escape those symbols when you want to match them literally. For example, =SUMIFS(B2:B10, A2:A10, "*apple*") sums all values in B2:B10 where the corresponding cell in A2:A10 contains the text “apple” anywhere.
How SUMIFS Wildcards Actually Work
SUMIFS adds numbers in a range based on one or more criteria. The criteria can be numbers, text, expressions, or cell references. When you use text criteria, Google Sheets treats * and ? as wildcards by default. The asterisk matches zero or more characters, so "*apple*" matches “apple”, “green apple”, “apple pie”, and “pineapple”. The question mark matches exactly one character, so "b?g" matches “bag”, “big”, and “bug”, but not “bg” or “brag”.
Wildcards work in the criteria argument of SUMIFS, SUMIF, COUNTIFS, COUNTIF, AVERAGEIFS, and AVERAGEIF. They do not work in the sum_range or criteria_range arguments, only in the criteria text itself. Also, wildcards are case-insensitive: "*APPLE*" matches “apple” as well.
Concrete Examples with Real Formulas
Assume you have a product list: A2:A10 contains product names, B2:B10 contains sales amounts. Here are several working formulas and their results:
- Starts with:
=SUMIFS(B2:B10, A2:A10, "Apple*")sums sales for all products whose name starts with “Apple” (e.g., “Apple”, “Apple Juice”). - Ends with:
=SUMIFS(B2:B10, A2:A10, "*Juice")sums sales for products ending in “Juice”. - Contains anywhere:
=SUMIFS(B2:B10, A2:A10, "*Berry*")sums sales for any product containing “Berry” (e.g., “Strawberry”, “Blueberry”). - Single character:
=SUMIFS(B2:B10, A2:A10, "?at")sums sales for “Cat”, “Bat”, “Hat”, but not “Cat Food”. - Multiple criteria:
=SUMIFS(B2:B10, A2:A10, "*Apple*", C2:C10, ">100")sums sales where product contains “Apple” and the quantity in C2:C10 is greater than 100.
If your data has actual asterisks or question marks in the text (like “5*5” or “Q?”), you need to escape them with a tilde: "*~?*" matches any text containing a literal question mark.
How to Match a Literal Asterisk or Question Mark
To sum values where the product name contains a literal asterisk, use ~* in the criteria. For example, =SUMIFS(B2:B10, A2:A10, "*~**") finds any cell that contains an asterisk anywhere (the first * matches any prefix, ~* matches a literal asterisk, and the trailing * matches any suffix). Similarly, to match a literal question mark, use ~?. If you need to match a tilde itself, use ~~.
Common Problems and Misconceptions
One frequent mistake is expecting wildcards to work in numeric criteria. For example, "*123*" will not match the number 123 because numbers are not treated as text. Convert numbers to text in the criteria range, or use a different approach like SUMPRODUCT with ISNUMBER(SEARCH()).
Another issue is using wildcards with cell references. If you write =SUMIFS(B2:B10, A2:A10, "*"&D2&"*"), that works fine because the ampersand concatenates the wildcard characters with the cell value. But if you write =SUMIFS(B2:B10, A2:A10, D2) and D2 contains “*apple*”, it will also work because the cell content is treated as the criteria text. However, if D2 contains just “apple” without asterisks, it will only match exact “apple”, not partial matches. To make it a partial match, you must add the asterisks in the formula or in the cell.
A third misconception is that wildcards are case-sensitive. They are not in Google Sheets. If you need case-sensitive matching, you have to use FILTER with EXACT or a helper column.
Alternatives to SUMIFS with Wildcards
When wildcards become too limiting, consider these alternatives:
- FILTER + SUM:
=SUM(FILTER(B2:B10, REGEXMATCH(A2:A10, "(?i)apple")))uses regular expressions for more complex patterns. - SUMPRODUCT with SEARCH:
=SUMPRODUCT(B2:B10, ISNUMBER(SEARCH("apple", A2:A10))*1)works for case-insensitive partial matches, and you can add more conditions. - QUERY:
=QUERY(A2:B10, "select sum(B) where A contains 'apple'")is a powerful alternative for more complex data manipulation.
For exact matches, you don’t need wildcards at all—just use the plain text or cell reference. For multiple partial-match criteria across different columns, SUMIFS with wildcards is usually the simplest.
Performance and Best Practices
Wildcards in SUMIFS are efficient for typical spreadsheet sizes (up to tens of thousands of rows). For very large datasets (over 100,000 rows), consider using QUERY or FILTER because they may be faster. Also, avoid using wildcards on full columns (like A:A) if you have many rows, as it can slow down recalculation. Instead, limit the ranges to the actual data area.
When building formulas, use cell references for criteria when possible so you can change the search term without editing the formula. For example, put the search term in D2 and use "*"&D2&"*".
Frequently Asked Questions
Can I use wildcards with SUMIFS on multiple columns? Yes, each criteria range can have its own wildcard pattern. For instance, =SUMIFS(B2:B10, A2:A10, "*apple*", C2:C10, "*red*") sums where column A contains “apple” and column C contains “red”.
Does SUMIFS wildcard work with dates? No, wildcards only work with text criteria. For dates, you need to use comparison operators like ">"&DATE(2024,1,1) or use the date as a text string in the same format as the cells, but that’s fragile. Better to use date ranges with SUMPRODUCT or FILTER.
Why is my SUMIFS with wildcard returning 0? Check that the criteria range actually contains text, not numbers. If the cells are numbers formatted as text, wildcards may still fail. Also, ensure the wildcard pattern is correct—for example, if you want to match “apple” anywhere, you need "*apple*", not just "apple*" (which only matches the start).
Can I use a wildcard in the sum_range? No, the sum_range must be a range of numbers, not text. Wildcards only apply to the criteria arguments.
Is there a way to do a case-sensitive wildcard match? Not directly with SUMIFS. Use SUMPRODUCT with EXACT and wildcard-like logic, or use FILTER with REGEXMATCH and the (?-i) flag to make it case-sensitive.
Related
- Google Sheets SUMIF Between Two Dates (Formula & Examples)
- Balance Sheet in QBO: What It Is & How to Read It
- Google Sheets SUMIF Between Dates: Formula & Examples
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Change Viewer Settings in ExcelChanging viewer settings in Excel lets you control how your workbook appears on screen — zoom level, gridlines,…
- Can You Add Audio to a PowerPoint Slideshow? Here’s HowYes. In PowerPoint for Microsoft 365 on Windows, add a sound file with Insert > Audio > Audio…
- Build an Enum from Excel Data: Practical Guide and ChecksYes. You can use Excel as the source for an enum by keeping each permitted name and its…
- Excel Adjust Page Breaks for a Better Print LayoutTo adjust a print page break in Excel for Microsoft 365 on Windows, choose View > Page Break…
- Conditional Formatting Excel Shortcut Key ExplainedIn Excel for Microsoft 365 on Windows, press Alt, then H, then L to open the Conditional Formatting…
- Compare Two Sheets in Excel: Methods That WorkTo compare cells in the same positions, put this formula in a third sheet; with the values to…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.