Function · Math
Excel SUMPRODUCT function
The Excel SUMPRODUCT function multiplies matching rows and adds the products. Two milks, one dozen eggs, and three oat milks total $25.64.
Syntax =SUMPRODUCT(array1, [array2], ...)
=SUMPRODUCT(B2:B4,C2:C4)Arguments
| Name | Required | What to pass |
|---|---|---|
| array1 | Required | The first range. With a second range, each row is multiplied and the products are added. |
| array2 | Optional | Another range of the same size. Text in a range you are multiplying as numbers causes #VALUE!. |
Examples
A three-line grocery extension
=SUMPRODUCT(B2:B4,C2:C4)Result $25.64
| A | B | C | |
|---|---|---|---|
| 1 | Item | Qty | Price |
| 2 | Whole milk | 2 | 3.49 |
| 3 | Eggs | 1 | 4.29 |
| 4 | Oat milk | 3 | 4.79 |
| 5 | Total | 25.64 |
SUMPRODUCT multiplies rows together and adds those products. Two gallons at $3.49 is $6.98, one dozen eggs at $4.29 is $4.29, and three cartons of oat milk at $4.79 is $14.37. The total is $25.64. You do not need a helper column of line totals.
The ranges must be the same size. Text in a numeric range is a #VALUE! error, not a skipped cell, which is stricter than SUM. SUMSQ skips that text inside a range and adds squares. SUMSQ(3, 4) is 25. People also use SUMPRODUCT for AND-style counts, multiplying a TRUE/FALSE test by an amount. That works because TRUE becomes 1 and FALSE becomes 0 when you multiply. It is harder to read than SUMIFS. Prefer SUMIFS unless you are stuck on an older file or you need OR logic that SUMIFS will not express.