Excel SUMPRODUCT
SUMPRODUCT multiplies matching rows from several ranges and adds up the results in one formula.
A purchasing officer needs the value of an order but has only quantities and unit prices. A helper column would work, but SUMPRODUCT gets there in one cell. Add a TRUE or FALSE test and it becomes a flexible conditional total.
Practice it nowHow to write it
=SUMPRODUCT(array1, [array2], ...)- array1
- The first range.
- array2
- Optional ranges of the same size.
Watch it work
E2fx
ABCDEF
1ItemQtyPrice
2Pens402
3Books1512
4Bags830
5Pads254
6
1
Examples
Total value of the order
=SUMPRODUCT(B2:B5,C2:C5)600Each quantity is multiplied by its price, then added.
Value of items priced above 5
=SUMPRODUCT((C2:C5>5)*B2:B5*C2:C5)420The test gives 1 or 0, which switches rows on or off.
How many lines exceed 10 units?
=SUMPRODUCT(--(B2:B5>10))3The double minus turns TRUE and FALSE into 1 and 0.
Your turn
Find the total value of items with a quantity of 20 or more. Type your formula in E2.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Item | Qty | Price | ||
| 2 | Pens | 40 | 2 | ||
| 3 | Books | 15 | 12 | ||
| 4 | Bags | 8 | 30 | ||
| 5 | Pads | 25 | 4 | ||
| 6 |
Common mistakes
#VALUE! error.
Ranges must be exactly the same size.
Text in a range used with *.
Multiplying text fails. Pass ranges with commas when text is possible.
Good to know
- A weighted average is SUMPRODUCT(values,weights)/SUM(weights).
- It handles conditions SUMIFS can't, such as a test on a calculated value.
- SUMPRODUCT or SUMIFS? SUMIFS is faster and easier to read for simple conditions. SUMPRODUCT is for row-by-row maths.
Excelio