How to Sumifs With Multiple Criteria And Or Logic in Excel

Learn multiple Excel methods to sum data with multiple criteria that include AND and OR logic. Step-by-step tutorials, real-world examples, and expert tips.

excelformulaspreadsheettutorial
11 min read • Last updated: 7/2/2025

How to Sumifs With Multiple Criteria And Or Logic in Excel

Why This Task Matters in Excel

In virtually every reporting, budgeting, or analytical workbook, you eventually need to add up numbers that meet more than one condition. A finance analyst may want to total revenue for a set of products and a specific quarter, while also allowing for any of several possible regions. A human-resources manager might need to sum training costs for employees who are either in Sales or Marketing and who were hired after 2020. Inventory specialists frequently add up stock levels for items that belong to Category A or Category B and are stored in Warehouse 3.

These scenarios share a pattern: they require AND logic (all mandatory criteria must be met) combined with OR logic (one of several acceptable values is enough). Excel’s classic SUMIFS is designed for AND logic only, so adding OR logic forces you to be a bit creative. Mastering this skill unlocks powerful, reusable formulas that drive dashboards, pivot-style summaries, and automated variance reports without helper columns or manual filtering.

From a business perspective, the ability to embed complex logical rules into a single formula reduces errors, speeds up monthly closes, and empowers non-technical team members to explore “what-if” questions on demand. Without this knowledge you may end up with sprawling helper columns, multiple manual filter steps, or, worse, incorrect aggregations that silently misinform decisions. Learning to combine AND and OR criteria properly also sharpens your understanding of array calculation, dynamic arrays, structured references, and Excel’s newer “spill” behavior, all of which are increasingly valuable in modern Excel workflows.

Best Excel Approach

The go-to solution for summing with AND+OR logic is a two-tier formula:

  1. Use SUMPRODUCT (works in every desktop version) or the SUM + FILTER combination (modern Microsoft 365) to introduce OR logic.
  2. Feed the resulting filtered range into the final summation.

Why these approaches?

  • SUMPRODUCT handles array operations in a single cell, respects AND and OR boolean math, and does not require entering as an old-style CSE array formula.
  • SUM + FILTER is fast, readable, and automatically “spills” the filtered rows, then sums them—all without evaluation quirks.

SUMIFS alone is not sufficient because each criterion you add is automatically AND-ed. To OR values you must either combine several SUMIFS calls or push the OR test inside an array calculation.

Recommended syntax (modern Excel):

=SUM( FILTER( Amounts ,
            (Region="South") * ((Category="A") + (Category="B")) ) )

Legacy compatible syntax:

=SUMPRODUCT( (Region="South") * ((Category="A") + (Category="B")) * Amounts )

Explanation of parameters:

  • Amounts – numeric range to add up
  • (Region="South") – mandatory criterion (TRUE/FALSE array)
  • ((Category="A") + (Category="B")) – OR criterion; addition treats TRUE as 1 so any match produces 1
  • Multiplication * forces AND logic between tests.

Choose SUMPRODUCT if colleagues use Excel 2010–2016 or if you prefer single-cell results without spill behavior. Choose SUM + FILTER for the clearest syntax and fastest recalc in Microsoft 365.

Parameters and Inputs

  1. Sum Range (numeric) – The cells you actually want to total, e.g. [D2:D1000]. Values must be numbers or numeric text; blanks and text are ignored.
  2. Criteria Ranges (text, numbers, dates) – One or more same-sized ranges that contain values you test. Each must align row-for-row with the sum range.
  3. Criteria Expressions – Logical comparisons such as Region="South" or HireDate>DATE(2020,12,31). They may reference constants, cells, dynamic arrays, or spills.
  4. OR Lists (arrays or ranges) – Sets of acceptable values, e.g. [\"A\",\"B\",\"C\"] or [F2:F4]. Use the plus symbol inside SUMPRODUCT, or ISNUMBER(MATCH()), or the implicit array logic that FILTER accepts.
  5. Optional Boolean Operators* for AND, + for OR within SUMPRODUCT. Parentheses are critical to enforce proper order.
  6. Data Preparation – Remove extra spaces, ensure consistent spelling, convert numbers stored as text, and format dates as true Excel dates.
  7. Edge Case Handling – Watch for empty OR lists, mismatched range sizes (returns #VALUE!), or entire criteria columns filled with blanks (results are zero). Use IFERROR() or N() to coerce blanks if needed.

Step-by-Step Examples

Example 1: Basic Scenario

Imagine a simple sales table:

RowRegionCategoryAmount
2SouthA1 250
3NorthB980
4SouthB1 775
5EastA650
6SouthC2 100

Goal: Sum sales where Region is South AND Category is A or B.

  1. Set Named Ranges to make the formula self-documenting:

    • Region → [B2:B6]
    • Category → [C2:C6]
    • Amounts → [D2:D6]
  2. Enter formula (SUMPRODUCT version):

=SUMPRODUCT( (Region="South") * ((Category="A") + (Category="B")) * Amounts )
  1. Breakdown:

    • Region="South" returns [TRUE, FALSE, TRUE, FALSE, TRUE].
    • Category="A" returns [TRUE, FALSE, FALSE, TRUE, FALSE].
    • Category="B" returns [FALSE, TRUE, TRUE, FALSE, FALSE].
    • Adding the two category arrays produces [1,1,1,1,0].
    • Multiplying arrays: [1,0,1,0,1] * [1,1,1,1,0] gives [1,0,1,0,0].
    • Final multiplication with Amounts selects [1 250,0,1 775,0,0]; sum = 3 025.
  2. Check result – The formula returns 3 025, matching manual verification (rows 2 and 4).

  3. Troubleshooting Variations:

    • Category typo (“ b ” with space) will exclude row 3; use TRIM() or Data Validation.
    • If you place Categories to OR in cells [F2:F3] you can replace ((Category="A")+ (Category="B")) with ISNUMBER(MATCH(Category,$F$2:$F$3,0)) for easy maintenance.

Example 2: Real-World Application

Scenario: A company’s budget sheet lists Expense Type, Department, Fiscal Quarter, and Amount across 5 000 rows. Management asks: “What is the total travel expense for either Sales or Marketing in Q2 and Q3 combined?”

Sample headers (row 1):

ABCD
Expense_TypeDepartmentQuarterAmount
  1. Define dynamic named ranges using Excel Tables (Table name: tblExpense). The formula will then read tblExpense[Department], etc. Tables auto-extend as data grows.

  2. Store OR Lists:

    • Department filter list: in [F2:F3] enter Sales, Marketing.
    • Quarter filter list: in [G2:G3] enter Q2, Q3.
  3. Modern formula (FILTER + SUM)

=LET(
     depts,      tblExpense[Department],
     qtrs,       tblExpense[Quarter],
     amts,       tblExpense[Amount],
     okDept,     ISNUMBER(MATCH(depts, F2:F3, 0)),
     okQuarter,  ISNUMBER(MATCH(qtrs, G2:G3, 0)),
     SUM( FILTER( amts, (tblExpense[Expense_Type]="Travel") * okDept * okQuarter ) )
)
  1. Explanation:

    • MATCH provides flexible OR lists with spill ranges.
    • Multiplication of booleans imposes AND across Expense_Type, Department OR list, Quarter OR list.
    • FILTER outputs only rows meeting all three filters; SUM aggregates results.
  2. Why this solves the business question: Management can now tweak the lists (e.g., add Customer Success) and the formula instantaneously updates—a powerful interactive report without VBA or PivotTables.

  3. Performance Note: Even with 50 000 rows this formula recalculates in milliseconds on modern hardware because FILTER works column-wise and spills a contiguous block directly into memory.

Example 3: Advanced Technique

Scenario: An operations analyst tracks machine downtime in minutes. Columns are Plant, Machine_Group, Downtime_Date, and Minutes. He needs total downtime:

  • Plants = Plant1 or Plant2 or Plant4
  • Machine_Group = GroupA
  • Downtime_Date between 1-Jan-2023 and 30-Jun-2023 OR between 1-Nov-2023 and 31-Dec-2023
    (yes, two separate fiscal windows)

Approach: Build compound booleans inside SUMPRODUCT, then wrap in N() to coerce TRUE/FALSE arrays to 1/0.

=SUMPRODUCT(
   N(ISNUMBER(MATCH(Plant, {"Plant1","Plant2","Plant4"}, 0))) *
   N(Machine_Group="GroupA") *
   N( (Downtime_Date>=DATE(2023,1,1)) * (Downtime_Date<=DATE(2023,6,30))
     + (Downtime_Date>=DATE(2023,11,1)) * (Downtime_Date<=DATE(2023,12,31)) ) *
   Minutes
)

Key insights:

  1. The date test uses two AND sub-tests joined by a plus (OR).
  2. Wrapping in N() ensures reliable conversion because Excel may treat booleans directly multiplied by arrays inconsistently in older versions.
  3. This formula maintains one pass through all rows, which is significantly faster than adding four separate SUMIFS results together.
  4. Error Handling: If any date cell contains text, the comparison returns #VALUE!; protect with --(ISNUMBER(Downtime_Date)) wrapper or cleanse data.

Professional Tips:

  • Consider turning the date ranges into parameter cells for easy maintenance.
  • For very large datasets, push data into Power Query or Power Pivot, but this single-cell approach is perfect for under 100 000 rows in desktop Excel.

Tips and Best Practices

  1. Name Your Ranges – Use meaningful names or Excel Tables so your OR logic is readable (Region="West") rather than cryptic letter coordinates.
  2. Bracket Aggressively – Always surround OR blocks with parentheses; (A="x")+(A="y") must be evaluated before AND multiplication.
  3. Leverage LET() – Break complex formulas into variables for clarity and one-time calculation of repeated expressions.
  4. Store OR Lists in Cells – Use MATCH() against a spill range instead of hard-coding values. It reduces formula edits and supports dropdown-driven dashboards.
  5. Watch Data Types – Dates stored as text, mixed number formats, or trailing spaces will silently cause criteria mismatches. Apply VALUE() or TRIM() as pre-clean steps.
  6. Audit with FILTER() – When results look off, temporarily replace SUMPRODUCT with FILTER to see exactly which rows pass the logic gate—a powerful debugging trick.

Common Mistakes to Avoid

  1. Mismatched Range SizesSUMPRODUCT returns #VALUE! if your boolean arrays differ in length. Verify all ranges are the same rows.
  2. Forgetting Parentheses – Writing A="x"+A="y" instead of (A="x")+(A="y") triggers “Type mismatch” or, worse, a silently wrong result (addition has higher precedence than equality).
  3. Using Commas Instead of Multiplication in Older Excel – In some locales commas separate arguments inside SUMPRODUCT; you must multiply booleans, not separate them by commas, or they are treated as separate arrays to sum individually.
  4. Hard-Coding OR Values Everywhere – Embedding "North","East","West" inside the formula bloats it and hides logic. Externalize to cells and use MATCH().
  5. Not Testing for Blank Cells – Blank criteria may evaluate as zero and accidentally filter out every row. Use LEN() checks or default the blank logic to TRUE.

Alternative Methods

MethodExcel VersionProsConsIdeal Use
Multiple SUMIFS added together2007+Simple if only 1 OR listQuickly becomes verbose, heavy recalcTwo or three OR items, small sheets
SUMPRODUCT Boolean Math2003+Single cell, handles any logicSyntax dense, easy to mis-parenthesiseCross-version sharing, power users
SUM + FILTER365Clean, readable, spills filtered listRequires Microsoft 365, spills extra cellsModern workbooks, dashboards
Helper Column for OR Flag + SUMIFSAllEasiest for beginnersAdds columns, manual updatesShared models with less-technical users
Power Pivot DAX Measure2010+ (Pro) / 365Handles millions of rows, sliceableNeeds Data Model knowledgeEnterprise BI, Power BI integration

Performance: SUMPRODUCT and FILTER both process entire columns but only evaluate once per recalc. Multiple SUMIFS runs a separate pass for each OR value, which may be slower at scale. However, on fewer than 100 000 rows the difference is negligible.

FAQ

When should I use this approach?

Use AND+OR summing when your report calls for totals constrained by multiple simultaneous rules—especially when at least one rule involves a list of acceptable values. It is perfect for regional roll-ups, multi-period comparisons, or scenario filtering without resorting to PivotTables.

Can this work across multiple sheets?

Yes. Qualify ranges with sheet names (Sheet2!A:A) or use 3D references inside SUMPRODUCT. Alternatively, consolidate ranges via CHOOSE(): =SUMPRODUCT( (CHOOSE([1,2],Sheet1!B:B,Sheet2!B:B)="East") * … ). For 365 users, stack sheets with VSTACK() then apply a single FILTER().

What are the limitations?

SUMPRODUCT on entire columns in pre-2019 builds can be slow with very large datasets. Additionally, array math cannot handle non-contiguous ranges. Complex OR lists inside SUMPRODUCT also raise the risk of writing mis-parenthesised formulas. If you need grouping or drill-down, consider a PivotTable or Power Pivot.

How do I handle errors?

Wrap numeric arrays with IFERROR(range,0) to ignore #DIV/0! or #N/A. For booleans, --NOT(ISERROR(criteria)) can pre-validate. In FILTER, supply an optional “if empty” argument: FILTER(data, criteria, 0) which returns 0 instead of #CALC!.

Does this work in older Excel versions?

SUMPRODUCT works in Excel 2003 onward without CSE entry, making it the most backward-compatible. FILTER, LET, and dynamic arrays require Microsoft 365 or Excel 2021. If distributing to older users, stick to SUMPRODUCT or helper columns.

What about performance with large datasets?

On 50 000-100 000 rows, both SUMPRODUCT and FILTER respond instantly. Beyond that, keep formulas off entire columns (use structured tables), avoid volatile functions, and consider pushing data into Power Query or the Data Model where DAX measures calculate more efficiently.

Conclusion

Being able to sum with intricate AND plus OR criteria elevates your analytical capabilities far beyond basic SUMIF. Whether you prefer the universal power of SUMPRODUCT or the elegance of FILTER in modern Excel, the techniques here let you replace cumbersome manual filters and fragile helper columns with rock-solid formulas. Master this skill and you will produce faster, leaner, and more dynamic reports—an essential competency for any Excel professional. Next, experiment with nesting these patterns inside larger models, incorporate user-driven slicers, and explore pivot-oriented alternatives to broaden your reporting toolbox.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.