Productivity

SUMIFS Explained: Add Up Numbers That Match Conditions

SUMIFS adds numbers that meet one or more conditions, such as sales by one person for one product. See the syntax, worked examples and common errors.

A tablet computer with a keyboard cover standing on a table
Photo: Tablet computer.jpg by KK IN HK, CC BY-SA 4.0, via Wikimedia Commons.
Key points
  • SUMIFS puts the range to sum first, then pairs of range and criteria
  • All conditions must be true for a row to be included
  • Criteria can use operators like ">32" and wildcards like "A*"
  • Ranges must be the same size

A common spreadsheet job is "add up the numbers, but only the ones that match". For example, total sales by one salesperson, or total expenses in one category for one month. The SUMIFS function does this with as many conditions as you need.

Microsoft's support page describes SUMIFS as one of the math and trig functions that adds all of its arguments that meet multiple criteria. Its own example is summing the number of retailers in a given postcode whose profits exceed a set value.

The syntax

From Microsoft's page:

SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

  • sum_range (required) is the range of cells to add up.
  • criteria_range1 (required) is the range that is tested against the first condition.
  • criteria1 (required) is the condition, which can be a number, text, a cell reference or an expression like ">32".
  • criteria_range2, criteria2 (optional) are more pairs. Microsoft says you can enter up to 127 range and criteria pairs.

Note that the range to add comes first. The older SUMIF function puts it last, which is a common source of confusion.

A worked example

Microsoft's page uses a table of quantities sold, products and salespeople:

Quantity sold Product Salesperson
5 Apples Tom
4 Apples Sarah
15 Artichokes Tom
3 Artichokes Sarah
22 Bananas Tom
12 Bananas Sarah
10 Carrots Tom
33 Carrots Sarah

If this table sits in A1:C9, then:

=SUMIFS(A2:A9, B2:B9, "=A*", C2:C9, "Tom")

adds the quantities where the product begins with A and the salesperson is Tom. Microsoft states the result is 20 (5 apples plus 15 artichokes). The asterisk is a wildcard that matches any characters.

A second example from the same page:

=SUMIFS(A2:A9, B2:B9, "<>Bananas", C2:C9, "Tom")

adds Tom's sales of everything except bananas. Using the same table, that is 5 + 15 + 10 = 30.

Writing criteria

  • Exact text or number: "Tom" or 32 or a cell reference like E2.
  • Comparison operators: ">32", "<=100", "<>Bananas" (not equal).
  • Wildcards: "A*" matches anything starting with A. "?" matches a single character.
  • Dates: You can use a cell holding a date, or build criteria like ">="&E1 to compare against a date in E1. Put the operator in quotes and join it to the cell with an ampersand.

When you use a comparison operator with a cell reference, the operator goes in quotes and is joined with &, for example ">"&B1.

Practical uses

Household budget: total spending for the category "Groceries" in a given month. Put the category in one column and the month in another, and use two criteria.

Small business sales: total revenue for one product line by one region.

Project hours: total hours logged by one person on one project.

Inventory: total units received for one supplier above a minimum quantity.

Common errors

  • Ranges are different sizes. Every criteria range must have the same number of rows and columns as the sum range. If one is shorter, the formula fails with an error.
  • Numbers stored as text. If the numbers you want to add are text, SUMIFS ignores them. Convert them to real numbers.
  • Extra spaces. "Tom " does not equal "Tom".
  • Wrong order. Putting criteria first, as in SUMIF, gives wrong results or errors.
  • Mixed conditions across sheets. Reference ranges on other sheets carefully, and keep the same sizes.
  • Forgetting that all conditions must be true. SUMIFS uses AND logic. For OR logic (Tom or Sarah), add two SUMIFS together.

Tips for readable formulas

  • Put criteria in cells, not inside the formula, so you can change them without editing.
  • Use named ranges or tables so formulas read like sentences.
  • Lock ranges with dollar signs when copying a formula down.

When to use a pivot table instead

If you want a whole table of totals, such as sales by product across every salesperson, writing one SUMIFS per cell is slow. A pivot table summarises data without formulas. Google's help page on customising pivot tables shows how to adjust a pivot table in Sheets; see our guide to pivot tables.

Combine with lookups

A typical workflow is to use a lookup formula to bring in a category or price, and then SUMIFS to total by category. See XLOOKUP vs VLOOKUP.

The short version

SUMIFS(sum_range, criteria_range1, criteria1, ...) adds numbers where every condition is true. Keep ranges the same size, clean your data, and use pivot tables when you need many totals at once.

Sources and further reading

  1. Microsoft Support, SUMIFS function
  2. Microsoft Support, XLOOKUP function
  3. Google Docs Editors Help, Customize a pivot table

How this page was made: drafted with the help of an AI writing assistant, then checked against the sources above. Software menus and policies change, so check the linked pages for the current version. Read our editorial policy or report a mistake.

A

A.Agaag
Editor and site owner at ArcClear. ArcClear publishes practical guides on everyday software, devices and online safety, and links to the official documentation behind each claim.