Using SUMIFS with multiple AND OR conditions
Categories:
Mastering SUMIFS: Combining AND/OR Logic for Advanced Excel Calculations

Unlock the full potential of Excel's SUMIFS function by integrating complex AND and OR conditions to perform precise, multi-criteria aggregations.
The SUMIFS
function in Excel is a powerful tool for summing values based on one or more criteria. While it inherently handles AND
logic (all specified criteria must be met), combining AND
with OR
conditions within a single SUMIFS
formula can be challenging. This article will guide you through various techniques to achieve complex conditional summing, allowing you to build highly flexible and robust Excel models.
Understanding SUMIFS Basics and Implicit AND Logic
Before diving into OR
conditions, let's quickly review how SUMIFS
works. The function sums values in a range that meet all specified criteria across corresponding ranges. Each criteria_range
/criteria
pair acts as an AND
condition. For example, to sum sales for 'Product A' and 'Region East', you would use two criteria pairs.
=SUMIFS(Sales_Range, Product_Range, "Product A", Region_Range, "East")
Basic SUMIFS with implicit AND logic
flowchart TD A["Start SUMIFS"] --> B{"Criteria 1: Product = 'Product A'"} B --> C{"Criteria 2: Region = 'East'"} C -- "Both True" --> D["Include in Sum"] C -- "One or Both False" --> E["Exclude from Sum"] D --> F["Final Sum"] E --> F
Flowchart illustrating SUMIFS's inherent AND logic
Implementing OR Logic within SUMIFS
When you need to sum values where a condition can be one of several options (e.g., 'Product A' or 'Product B'), SUMIFS
alone isn't enough. You have a few primary strategies to introduce OR
logic:
Method 1: Summing Multiple SUMIFS Functions
The simplest way to achieve OR
logic is to add together multiple SUMIFS
functions, one for each OR
condition. This works well when the OR
conditions apply to the same criteria range.
=SUMIFS(Sales_Range, Product_Range, "Product A", Region_Range, "East") + SUMIFS(Sales_Range, Product_Range, "Product B", Region_Range, "East")
SUMIFS with OR logic by adding multiple SUMIFS functions
Method 2: Using Array Constants with SUM and SUMIFS
For OR
conditions on a single criterion, you can use an array constant within SUMIFS
and wrap the entire expression in a SUM
function. This is a more compact solution than adding multiple SUMIFS
.
=SUM(SUMIFS(Sales_Range, Product_Range, {"Product A","Product B"}, Region_Range, "East"))
SUMIFS with OR logic using an array constant (requires Ctrl+Shift+Enter in older Excel versions)
Ctrl+Shift+Enter
and will spill automatically. For older versions, remember to confirm with Ctrl+Shift+Enter
.Method 3: Combining AND/OR with SUMPRODUCT (Advanced)
For more complex scenarios involving AND
and OR
conditions across different criteria ranges, SUMPRODUCT
offers greater flexibility. It works by evaluating each condition as TRUE
(1) or FALSE
(0) and multiplying them. For OR
conditions, you add the conditions together. Remember to enclose each condition in parentheses.
=SUMPRODUCT(Sales_Range * ((Product_Range="Product A") + (Product_Range="Product B")) * (Region_Range="East"))
SUMPRODUCT for complex AND/OR logic: (Product A OR Product B) AND (Region East)
flowchart TD A["Start SUMPRODUCT"] B["Condition 1: Product = 'Product A'"] C["Condition 2: Product = 'Product B'"] D["Condition 3: Region = 'East'"] A --> B A --> C A --> D B -- "(B + C)" --> E["OR Logic: (Product A OR Product B)"] E -- "* D" --> F["AND Logic: (OR) AND (Region East)"] F -- "* Sales_Range" --> G["Multiply by Sales Value"] G --> H["Sum All Results"] H --> I["Final Sum"]
SUMPRODUCT logic for combining AND and OR conditions
Practical Example: Sales Data Analysis
Let's say you have sales data with columns for 'Product', 'Region', and 'Sales Amount'. You want to sum sales for 'Product X' in 'North' region, OR 'Product Y' in 'South' region.
=SUMIFS(Sales_Amount, Product_Column, "Product X", Region_Column, "North") + SUMIFS(Sales_Amount, Product_Column, "Product Y", Region_Column, "South")
Using multiple SUMIFS for (Product X AND North) OR (Product Y AND South)
=SUMPRODUCT(Sales_Amount * (((Product_Column="Product X") * (Region_Column="North")) + ((Product_Column="Product Y") * (Region_Column="South"))))
Using SUMPRODUCT for (Product X AND North) OR (Product Y AND South)