
When you need to multiply two columns row by row and add up the results in Excel, many people first create a helper column and then sum it. SUMPRODUCT does this in one formula, and it also covers conditional sums, multi-criteria counts and weighted averages where SUMIFS and COUNTIF fall short. In this guide you learn the function from scratch with real work examples.
What does SUMPRODUCT do?
The function multiplies the cells in the same position of the ranges you give it and returns the sum of the products.
=SUMPRODUCT(array1, array2, ...)
For example, if B2:B6 holds quantities and C2:C6 holds unit prices, total revenue is:
=SUMPRODUCT(B2:B6, C2:C6)
It is equivalent to B2*C2 + B3*C3 + B4*C4 + B5*C5 + B6*C6. No helper column is needed; when the table grows you only update the range size.
An important rule: all arrays must have the same size. If you give B2:B6 and C2:C7 the formula returns a #VALUE! error.
Example 1: total revenue in a sales table
| Product | Quantity | Unit price |
|---|---|---|
| Pen | 120 | 8 |
| Notebook | 45 | 35 |
| Bag | 12 | 250 |
If products are in A2:A4, quantities in B2:B4 and prices in C2:C4, total revenue is =SUMPRODUCT(B2:B4, C2:C4). The result is 120*8 + 45*35 + 12*250 = 5,535.
Example 2: weighted average
When each exam has a different weight, a plain AVERAGE gives the wrong result. If grades are in B2:B4 and weights (percentages) in C2:C4:
=SUMPRODUCT(B2:B4, C2:C4) / SUM(C2:C4)
If the weights add up to 1 (100 percent) no division is needed. The same logic is used for portfolio returns, cost averages and average price by product.
Conditional calculation: logical tests instead of products
SUMPRODUCT's real strength is that you can write conditions inside the array. A condition (A2:A20="London") produces TRUE/FALSE per row. When Excel converts them to 1 and 0 the condition works like a filter.
Why is the double minus (--) needed? TRUE/FALSE are not numbers; SUMPRODUCT treats text and logical values as zero. Putting two minus signs (--) in front turns them into 1 and 0. Alternatively, multiply the condition by a number: (A2:A20="London")*1.
One condition: total units sold in London
=SUMPRODUCT(--(A2:A20="London"), B2:B20)
Several conditions (AND logic): London and January
=SUMPRODUCT(--(A2:A20="London"), --(C2:C20="January"), B2:B20)
OR logic: London or Paris
The plus sign means OR:
=SUMPRODUCT((((A2:A20="London")+(A2:A20="Paris"))>0)*B2:B20)
You need the extra brackets; Excel applies the order of operations accordingly.
Conditional revenue: multiply quantity by price and filter
With region in column A, quantity in B and price in C, London's revenue is:
=SUMPRODUCT(--(A2:A20="London"), B2:B20, C2:C20)
This is not possible with SUMIF, because SUMIF cannot multiply two columns and sum them.
SUMIF, SUMIFS and SUMPRODUCT: which one when?
| Need | Recommended |
|---|---|
| Summing one column on one or several conditions | SUMIFS (more readable, faster) |
| Multiplying two columns and summing | SUMPRODUCT |
| A conditional sum of products | SUMPRODUCT |
| Searching with wildcards or part of a text | SUMIFS |
| Summing by a calculated criterion such as text length, month or year | SUMPRODUCT |
| A very large table (hundreds of thousands of rows) | SUMIFS; SUMPRODUCT is slower |
We covered conditional sums in detail in our SUMIFS guide; the two functions complement each other.
Calculated criteria: month, year and text length
In SUMIF the criterion depends directly on the cell value. SUMPRODUCT can use the result of a function as the condition.
- Total for a given year (dates in column A):
=SUMPRODUCT(--(YEAR(A2:A100)=2026), B2:B100) - Total for a given month:
=SUMPRODUCT(--(MONTH(A2:A100)=3), B2:B100) - Products with a 3-character code:
=SUMPRODUCT(--(LEN(A2:A100)=3), B2:B100) - Sales that fall on a weekend:
=SUMPRODUCT(--(WEEKDAY(A2:A100,2)>5), B2:B100)
Counting unique values
A classic way to find how many different customers a list contains:
=SUMPRODUCT(1/COUNTIF(A2:A100, A2:A100))
Each value contributes the inverse of its own number of repeats, and the total is the number of unique values. Note: if the range has a blank cell you get a #DIV/0! error; in that case add a condition that excludes blanks. In Microsoft 365 the UNIQUE and COUNTA functions are simpler for this (see our data cleaning guide).
Common mistakes and fixes
- Array sizes are not equal. All ranges must have the same number of rows.
- Not putting -- before the condition. The result is zero.
- Number columns containing text. Numbers stored as text, like "120", count as zero; convert them to numbers first.
- Including the header row in the range. Headers are text and cause an error or zero.
- Very large ranges. Giving a whole column (A:A) slows the calculation; use the real data range or prefer a table.
- Semicolon/comma confusion. In some language versions the separator is a semicolon, in the English version it is a comma.
Practice: step by step on your own table
- Convert your data to a table with headers (Ctrl + T).
- First find the correct result with a helper column (for example quantity*price).
- Write the SUMPRODUCT formula that produces the same result and compare.
- Add conditions, one at a time.
- Cross-check the result with SUMIFS where possible.
- Document the formula: write a short note beside it so it is still understandable six months later.
Frequently asked questions
Is SUMPRODUCT an array formula? The function handles arrays internally; even in older versions it does not need Ctrl + Shift + Enter.
Does it work in Google Sheets? Yes, under the same name; the logic is the same (see our Sheets vs Excel guide).
How do I sum by a date range? With =SUMPRODUCT(--(A2:A100>=DATE(2026,1,1)), --(A2:A100<=DATE(2026,3,31)), B2:B100).
It has become very slow, what should I do? Shrink the range, switch to SUMIFS or pre-aggregate the data with Power Query.
Do cells containing errors cause problems? Yes; if an error comes from one cell in the range the whole result is an error. Clean the source first (see our Excel errors guide).
Summary
SUMPRODUCT is the one-formula solution for multiply-and-sum, weighted averages, multi-criteria calculations and calculated criteria. Remember the double minus before conditions, keep array sizes equal and prefer SUMIFS on big data. Trying a few examples on your own data is the fastest way to learn the function for good.
Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.