SUMIF
Add up numbers in a range that meet a specific condition with SUMIF
Syntax
=SUMIF(range, criteria, [sum_range])
Returns: Number Arguments
| Argument | Required | Description |
|---|---|---|
| range | Yes | The range of cells that you want to apply the criteria to. |
| criteria | Yes | The condition or criteria that determines which cells to add. |
| sum_range | No | The actual cells to sum if you want to apply the criteria to a different range than the range being evaluated. |
About
Use SUMIF when you need conditional totals but don't want to manually filter your data first. It's faster than sorting through rows yourself and updates automatically when your data changes. For more complex scenarios with multiple conditions, check out SUMIFS. If you need to count instead of sum, try COUNTIF.
SUMIF works with numbers, text, and dates. You can use comparison operators (>, <, >=, <=, <>) in your criteria, and wildcards (* and ?) for partial text matches. If you skip the sum_range argument, Excel sums the cells in the range argument that meet your criteria.
Examples
Separating income from expenses
Spreadsheet editor
Mismatched range pitfall
Spreadsheet editor
Watch out for
Mismatched range sizes
If your sum_range is a different size than your range argument, Excel sums starting from the first cell in sum_range using the same dimensions as range. This can lead to summing the wrong cells.
→ Always make sure range and sum_range have the same number of rows and columns. If you're checking A2:A100, your sum_range should also span 99 cells.
Text criteria without quotes
Using text criteria like =SUMIF(A1:A10, Sales, B1:B10) without quotes around "Sales" causes Excel to look for a cell named Sales instead of the literal text.
→ Wrap text criteria in double quotes: =SUMIF(A1:A10, "Sales", B1:B10). This also applies to comparison operators with numbers like ">100".
Long text strings
SUMIF returns incorrect results when matching text longer than 255 characters, or when trying to match the error value #VALUE!.
→ Keep criteria text under 255 characters. For longer text comparisons, consider using helper columns to create shorter identifier codes.
Case sensitivity confusion
SUMIF treats "sales", "Sales", and "SALES" as identical, which might not match your expectations if you're tracking case-sensitive product codes.
→ SUMIF is always case-insensitive. If you need case-sensitive matching, you'll need to use a different approach with SUMPRODUCT and EXACT.
Tips & notes
Common questions
How do I use comparison operators in SUMIF criteria?
Can I use cell references in my criteria?
What's the difference between SUMIF and SUMIFS?
Why is my SUMIF returning zero when I know there are matches?
Practice this function
Bank statement reconciliation
AdvancedReconcile a bank statement with internal records, identify missing items.