The Google Sheets SUMIF syntax is =SUMIF(range, criterion, [sum_range]). It adds numbers in a range only when cells in a corresponding range match a condition, such as =SUMIF(A2:A20, "West", B2:B20).
What SUMIF Does
SUMIF is a conditional summing function. It scans a range of cells, checks each cell against a criterion you supply, and then adds up values from a second range (the sum_range) for every row where the criterion is true. If you omit the third argument, it sums the cells in the original range that match the criterion. This makes it ideal for totals like “sum all sales for the West region” or “sum all expenses over $100.”
Breaking Down the Syntax
The function has three parts:
- range – the cells to check against the criterion (e.g.,
A2:A20). - criterion – the condition, written as text, number, or expression (e.g.,
"West",100,">100"). - sum_range – optional; the actual cells to sum. If omitted, SUMIF sums the range itself.
The range and sum_range must be the same size. If they are not, Google Sheets uses the top-left cell of sum_range and extends it to match the range’s dimensions, but it is safer to keep them aligned.
Real-World Examples
Assume a sheet with regions in column A (A2:A20) and sales in column B (B2:B20).
- Sum sales for “West”:
=SUMIF(A2:A20, "West", B2:B20)→ returns the total of all B values where A equals “West”. - Sum sales over 500:
=SUMIF(B2:B20, ">500")→ sums B values that are greater than 500 (no sum_range needed). - Sum sales for all regions except “East”:
=SUMIF(A2:A20, "<>East", B2:B20)→ uses the not-equal operator. - Sum sales for region “North” or “South” using wildcards:
=SUMIF(A2:A20, "N*", B2:B20)→ matches any region starting with “N”.
Using Wildcards and Operators
SUMIF supports three wildcards:
*– matches any sequence of characters (e.g.,"*east"matches “Northeast” and “Southeast”).?– matches any single character (e.g.,"B?t"matches “Bat” and “Bet”).~– escapes a wildcard, so"~*"matches a literal asterisk.
For numeric comparisons, enclose the operator in quotes: ">=100", "<50", "<>0". For text, you can use "=West" or just "West"; both work. To match a cell reference in the criterion, concatenate: =SUMIF(A2:A20, "="&D1, B2:B20) sums rows where A equals the value in D1.
Common Mistakes and Fixes
One frequent error is using a comma instead of a semicolon in some locales – Google Sheets uses the locale's list separator, so in many European versions you need =SUMIF(A2:A20; "West"; B2:B20). Another issue is mismatched ranges: if range is A2:A20 and sum_range is B2:B19, results will be wrong. Also, SUMIF is case-insensitive: "west" matches "West" and "WEST". If you need case-sensitive matching, use SUMIFS with a helper column or FILTER.
SUMIF vs. SUMIFS
SUMIFS is the multi-condition version: =SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...]). Note the order: sum_range comes first in SUMIFS, but last in SUMIF. Use SUMIFS when you have two or more conditions, such as summing sales for "West" in "Q1". For a single condition, SUMIF is simpler. Both are real Google Sheets functions and work in Excel with the same syntax, though Excel's SUMIFS also has this order.
Alternatives: SUM, FILTER, and QUERY
For more flexibility, consider:
=SUM(FILTER(B2:B20, A2:A20="West"))– FILTER returns an array, then SUM adds it. This allows complex logic like(A2:A20="West")*(B2:B20>100).=QUERY(A2:B20, "select sum(B) where A='West' label sum(B) ''")– powerful for grouped sums and multiple conditions.=SUMIFS(B2:B20, A2:A20, "West", C2:C20, ">100")– for two or more criteria.
Each has its place; SUMIF is the most straightforward for a single condition.
Frequently Asked Questions
Can SUMIF sum based on cell color? No, SUMIF cannot read cell formatting. It only looks at values. To sum by color, you would need a Google Apps Script custom function or a manual helper column.
How do I sum if a cell contains specific text? Use a wildcard: =SUMIF(A2:A20, "*apple*", B2:B20) sums all rows where A contains the word "apple" anywhere.
Why is my SUMIF returning 0? Check that the criterion matches exactly, including spaces. Also verify that the sum_range contains numbers, not text. If the range is text-formatted numbers, SUMIF may ignore them.
Can I use SUMIF with dates? Yes, but you need to provide the date as a serial number or use the DATE function: =SUMIF(A2:A20, ">="&DATE(2025,1,1), B2:B20) sums all dates on or after Jan 1, 2025.
Does SUMIF work across multiple sheets? Yes, you can reference another sheet: =SUMIF(Sheet2!A2:A20, "West", Sheet2!B2:B20). For multiple sheets, you would need to add multiple SUMIFs or use QUERY with IMPORTRANGE.
Is SUMIF case-sensitive? No, by default it is not. If you need case-sensitive matching, use FILTER with EXACT, like =SUM(FILTER(B2:B20, EXACT(A2:A20, "West"))).
Related
- Sitting and Standing Balance Grading Scale
- VA Data Entry & Administrative Support Explained
- Hotel Cash Flow Template Excel: How to Build One
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 Hide Columns in Excel Only for You Using Sheet ViewsTo hide columns in a shared Excel workbook only for yourself, create a personal Sheet View first, then…
- Excel Conditional Formatting for Duplicate ValuesTo highlight duplicate values in Excel for Microsoft 365 on Windows, select the cells, then choose Home >…
- Excel Dropdown From Another Sheet: Setup and FixesYes. In Excel for Microsoft 365 on Windows, create a workbook-level named range for the cells on the…
- Excel Import CSV with Line Breaks Without Splitting RowsTo import a CSV with line breaks inside a field without splitting its record across Excel rows, use…
- Outlook Calendar Share Request: How to Send and Manage OneTo share your Outlook calendar, open Calendar, choose Share Calendar or Share, enter the recipient, set their permission…
- Excel Shortcut to Expand All Columns to Fit ContentsIn Excel for Microsoft 365 on Windows, select the whole worksheet and press Alt, H, O, I in…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.