SUMIF with Multiple Criteria in Same Column – Google Sheets

Published on

Need to conditionally sum a column with SUMIF based on multiple criteria in the same column? Here’s how to do it efficiently in Google Sheets!

When using multiple criteria in the same column, a typical approach is to write separate SUMIF formulas for each criterion and add them together, like this:

=SUMIF(range, criterion1, sum_range) + SUMIF(range, criterion2, sum_range)

While this works, there’s a simpler and more efficient way:

=ArrayFormula(SUMIF(range, {criterion1; criterion2; ...}, sum_range))

Let’s compare both methods to show the benefits of the recommended formula.

SUMIF with Multiple Criteria (Standard Way)

Let’s say you want to find the total quantities for the fruits “Apple” and “Pear” in a sample dataset. The fruit names are in column A, and the quantities are in column E. Using separate SUMIF formulas, the expression would look like this:

=SUMIF(A2:A7, "Apple", E2:E7) + SUMIF(A2:A7, "Pear", E2:E7)

This results in a total of 22.

While this approach works, it has a drawback: you must create a separate SUMIF formula for each criterion.

SUMIF with Multiple Criteria in the Same Column - Method 1

SUMIF with Multiple Criteria (Optimal Method)

Now, let’s combine both criteria into a single SUMIF formula using an array and ArrayFormula:

=ArrayFormula(SUM(SUMIF(A2:A7, {"Apple"; "Pear"}, E2:E7)))

Result: 22

In this formula:

  • We list the criteria within curly brackets {}.
  • ArrayFormula processes each criterion in the array.
  • Wrapping it in SUM combines the totals for each criterion.

If you remove the SUM function, the formula returns separate totals for each item in different cells.

When specifying multiple criteria, you can also use the VSTACK or HSTACK functions instead of array constants:

=ArrayFormula(SUM(SUMIF(A2:A7, VSTACK("Apple", "Pear"), E2:E7)))
=ArrayFormula(SUM(SUMIF(A2:A7, HSTACK("Apple", "Pear"), E2:E7)))

These are the most efficient ways to use SUMIF with multiple criteria in the same column in Google Sheets.

Bonus Tip: Group-Wise Summary with SUMIF in Google Sheets

You can extend this array-based SUMIF formula to generate a summary by category. Here’s how:

Use the UNIQUE function to extract unique items (e.g., unique fruit names) in a column:

=UNIQUE(A2:A7)

Then, apply an ArrayFormula-enhanced SUMIF to total each unique item:

SUMIF with Multiple Criteria in the Same Column and Individual Results
=ArrayFormula(SUMIF(A2:A7, C10:C13, E2:E7))

Advanced Users: You can combine UNIQUE and SUMIF in a single formula to generate both the unique items and their totals together:

={UNIQUE(A2:A7), ArrayFormula(SUMIF(A2:A7, UNIQUE(A2:A7), E2:E7))}

This formula will display the unique items in one column and their respective totals in the adjacent column.

Final Thoughts

Try these formulas in your sheet to understand how they work and optimize your calculations. With these techniques, you can efficiently sum based on multiple criteria in the same column and even generate grouped summaries.

Hope this helps you master SUMIF with multiple criteria in Google Sheets!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Marking Case-Sensitive Unique Values in Excel

Marking case-sensitive unique values provides several benefits compared to merely extracting them in an...

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.