How to use SUMPRODUCT in Excel
SUMPRODUCT multiplies ranges item by item and adds the results — the total value of an order in one formula. It also accepts conditions, which makes it a powerful alternative to SUMIFS that works in every Excel version.
Syntax
=SUMPRODUCT(array1, [array2], ...)
array1 | The first range. |
[array2], … | More ranges of the same size, multiplied with the first. |
Examples
=SUMPRODUCT(B2:B10, C2:C10)Quantity × price for every row, added up.=SUMPRODUCT((A2:A10="North")*B2:B10*C2:C10)Revenue for the North region only.=SUMPRODUCT(B2:B10, C2:C10)/SUM(B2:B10)Weighted average price.Multiply and add in one step
SUMPRODUCT multiplies the ranges row by row and adds up the results, so you don't need a helper column. The ranges must be the same size.
=SUMPRODUCT(C2:C100, D2:D100)Total value: quantity times price for every row, added up.=SUMPRODUCT(B2:B100, C2:C100)/SUM(B2:B100)A weighted average, like the average interest rate weighted by loan size.Conditions without SUMIFS
A comparison like (A2:A100="North") gives TRUE or FALSE for each row. Multiplied by a number, TRUE becomes 1 and FALSE 0, so only the matching rows count.
=SUMPRODUCT((A2:A100="North")*(C2:C100="Loan")*D2:D100)Loan amounts in the North region.=SUMPRODUCT((A2:A100="North")+(A2:A100="South"), D2:D100)North or South: + works as OR.=SUMPRODUCT(--(MONTH(E2:E100)=11), D2:D100)Amounts dated in November of any year, something SUMIFS can't do directly.Common mistakes
- #VALUE! error
- The ranges have different sizes, e.g.
B2:B10andC2:C11. - Conditions return 0
- TRUE/FALSE must be turned into 1/0 — multiply them (
(A2:A10="North")*…) or use--.
Frequently asked questions
Why does SUMPRODUCT return #VALUE!?
The ranges have different sizes, or a range contains text that is being multiplied. Check that every range starts and ends on the same rows.
What does the double minus (--) do?
It turns TRUE and FALSE into 1 and 0. --(A2:A100="North") gives a list of ones and zeros that SUMPRODUCT can add up.
Should I use SUMPRODUCT or SUMIFS?
SUMIFS is faster and easier to read for normal conditions. Use SUMPRODUCT when you need to calculate on the data first, like MONTH() of a date, or to multiply two columns.
How do I calculate a weighted average in Excel?
Divide SUMPRODUCT of the values and the weights by the sum of the weights: =SUMPRODUCT(B2:B100, C2:C100)/SUM(B2:B100).
Available in: All versions of Excel, Excel for the web, Google Sheets