Excel SUMPRODUCT: The Most Powerful Formula You're Not Using
SUMPRODUCT looks like a niche maths function but it is one of Excel's most versatile tools — it counts, sums, and analyses data with multiple conditions that SUMIFS and COUNTIFS cannot handle, without any special key combination.
Syntax
All arrays must be the same size. SUMPRODUCT multiplies corresponding elements across arrays, then sums all the results. When used with TRUE/FALSE arrays, it counts or sums rows that match conditions.
How the Logic Works
Understanding SUMPRODUCT starts with knowing that Excel treats TRUE as 1 and FALSE as 0 in maths operations.
When you write (A2:A100="North"), Excel evaluates every cell in that range against "North" and creates an array of TRUE/FALSE values. Multiplying that by another condition array — (B2:B100="Q1") — gives 1×1=1 only where both are TRUE, and 0 for everything else. SUMPRODUCT then sums the resulting array.
This is AND logic (multiply). For OR logic (add), use + instead of *, then wrap with >0 to keep the result binary.
8 SUMPRODUCT Examples
Basic: multiply and sum two columns
=SUMPRODUCT(B2:B100, C2:C100)Multiplies each quantity (column B) by each price (column C) and sums all the products. Classic use case for calculating total revenue from a line-item table.
Count rows matching one condition
=SUMPRODUCT((A2:A100="North")*1)The (A2:A100="North") part creates an array of TRUE/FALSE values. Multiplying by 1 converts TRUE to 1 and FALSE to 0. SUMPRODUCT sums them — equivalent to COUNTIF(A2:A100,"North") but extensible to multiple conditions.
Count rows matching multiple conditions (AND)
=SUMPRODUCT((A2:A100="North")*(B2:B100="Q1"))Multiplying two condition arrays applies AND logic — both must be TRUE for the product to be 1. Counts rows where region is "North" AND quarter is "Q1".
Sum matching multiple conditions
=SUMPRODUCT((A2:A100="North")*(B2:B100="Q1")*C2:C100)Adds the revenue column (C) as the third factor. Only rows where both conditions are TRUE contribute to the sum — all others multiply to 0.
Count with OR condition
=SUMPRODUCT(((A2:A100="North")+(A2:A100="South"))>0)Using + instead of * applies OR logic. The >0 converts the result back to TRUE/FALSE — any row that matches either condition is counted once.
Count distinct (unique) values
=SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100))Counts the number of unique values in a range. Warning: errors if the range has blank cells. For ranges with blanks: =SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100, A2:A100&"")).
Rank without ties
=SUMPRODUCT((C2:C100>C2)*1)+1Counts how many values in column C are larger than the value in C2, then adds 1. Row C2's rank = (number of values larger than it) + 1. Copy down for all rows.
Weighted average
=SUMPRODUCT(B2:B100, C2:C100)/SUM(C2:C100)Calculates a weighted average where column C is the weight. Used for grade-point averages, weighted ratings, and cost-weighted averages.
SUMPRODUCT vs SUMIFS: When to Use Each
- Use SUMIFS for straightforward multi-condition sums: faster, cleaner syntax, and Excel can optimise it better for large ranges.
- Use SUMPRODUCT when you need:
- Case-sensitive matching (SUMIFS is case-insensitive)
- Complex boolean logic mixing AND and OR
- Conditions involving calculations or formulas (SUMIFS only accepts simple criteria)
- Counting distinct values
- Ranking or weighted calculations
Performance Note
SUMPRODUCT evaluates every row in the range on every recalculation. For large datasets (100,000+ rows), SUMPRODUCT can be slow. If performance is an issue:
- Use SUMIFS/COUNTIFS instead — they are significantly faster for simple conditions
- In Excel 365, SUMPRODUCT works on whole columns but SUMIFS on structured Table columns is faster
- Avoid using full-column references like A:A in SUMPRODUCT — specify the actual data range
SUMPRODUCT with Double Negative (--)
You may see formulas like =SUMPRODUCT(--(A2:A100="North"), C2:C100). The double negative -- converts TRUE/FALSE to 1/0 explicitly. It is functionally equivalent to multiplying by 1 but slightly faster. Both approaches work — choose whichever is clearer to you.
Frequently Asked Questions
What does SUMPRODUCT do in Excel?
Multiplies corresponding elements of arrays and sums the products. Most powerfully used for conditional counting and summing with multiple criteria — no Ctrl+Shift+Enter needed.
What is the difference between SUMPRODUCT and SUMIFS?
SUMIFS is faster for simple multi-condition sums. SUMPRODUCT is more flexible — use it for case-sensitive matching, OR conditions, counting distinct values, rankings, and weighted averages that SUMIFS cannot handle.
How do I count unique values with SUMPRODUCT?
=SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100)) counts distinct values. Add a blank-check if the range might contain empty cells: =SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100, A2:A100&"")).
Related Guides
SUMIFS and COUNTIFS
Start here for multi-condition sums — faster than SUMPRODUCT for most scenarios.
Read →
Dynamic Arrays
FILTER and UNIQUE replace some SUMPRODUCT patterns with cleaner, spilling formulas.
Read →
Array Formulas
SUMPRODUCT is an implicit array formula — understand how arrays work in Excel.
Read →
Excel Formulas Hub
All essential formula categories including lookup, statistical, and text functions.
Read →