Going Stellar

Home/Google Sheets reference

Google Sheets function · Math

SUMIFS in Google Sheets: syntax and examples

SUMIFS adds the values in sum_range for rows where every condition is true. Each condition is a pair of a range and a criterion, and all ranges must have the same size.

Syntax

SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])

Arguments

ArgumentTypeRequiredWhat it does
sum_rangerangeyesThe cells to add up. It is always the first argument, unlike SUMIF.
criteria_range1rangeyesThe first range the condition is tested on. It must have the same size as sum_range.
criterion1anyyesThe condition: a value, a comparison such as ">=5", or a pattern with * and ?.
criteria_range2rangenoA second range to test. Rows must pass every condition to be added.
criterion2anynoThe condition for criteria_range2. Add more range and criterion pairs as needed.

Examples

The examples use this table, starting in A1:

RegionProductUnitsRevenue
NorthLamp10799
SouthLamp4319.6
NorthChair21098
SouthChair52745
NorthLamp6479.4
=SUMIFS(D2:D6, A2:A6, "North")

Result: 2376.4

Revenue of one region: a single condition, same as SUMIF but with sum_range first.

Run in a Google Sheet (English US locale) on .

=SUMIFS(D2:D6, A2:A6, "North", B2:B6, "Lamp")

Result: 1278.4

Two conditions at once. A row is added only when both match.

Run in a Google Sheet (English US locale) on .

=SUMIFS(C2:C6, C2:C6, ">=5")

Result: 21

The same column is both the sum range and the test range: add only the order lines with 5 units or more.

Run in a Google Sheet (English US locale) on .

=SUMIFS(D2:D6, B2:B6, "<>Lamp")

Result: 3843

Everything except one product, using the <> operator.

Run in a Google Sheet (English US locale) on .

=SUMIFS(D2:D6, B2:B6, "L*")

Result: 1598

A wildcard: * stands for any text, so the criterion matches every product starting with L.

Run in a Google Sheet (English US locale) on .

Common errors

  • Every criteria range must have exactly as many rows and columns as sum_range. A2:A5 against D2:D6 returns #VALUE!.
  • Each criteria range needs its own criterion. A range left without one returns #N/A.
  • Conditions are joined with AND. To add rows that match one condition or another, add two SUMIFS together.
  • Text criteria ignore case, and a comparison such as ">=5" is written as text in quotes. To use a cell value, join it: ">="&F1.

Compared with Excel

Same syntax and argument order as Excel SUMIFS.

Sources

  1. SUMIFS (Docs Editors Help)

Markdown version · All functions