What SUMPRODUCT does

SUMPRODUCT multiplies the values on each row of two or more ranges, then adds up those products. =SUMPRODUCT(B2:B5,C2:C5) works out B2*C2+B3*C3+B4*C4+B5*C5, so a column of quantities and a column of prices give the order total in one cell, without a helper column of line amounts.

Picture the two columns side by side. Each row is multiplied across, and the results are added down. At work that covers invoice totals, stock valuations, averages weighted by volume, and totals of only the rows that meet a condition.

The ranges have to be the same size. Text and empty cells count as 0, so a note such as “n/a” in the quantity column adds nothing to the total and causes no error.

Syntax

=SUMPRODUCT(array1, [array2], [array3], ...)
Arguments in square brackets are optional; the rest are required.
array1Required
The first range, such as the quantities in B2:B5. It can also be a calculation on a range, like (A2:A7="East")*C2:C7, which is how SUMPRODUCT takes conditions.
array2Optional
The second range, the same size as the first, such as the prices in C2:C5. Each value is multiplied by the one in the same position of array1.
array3Optional, can repeat
More ranges of the same size, multiplied in as well. A range with a different number of rows or columns gives #VALUE!.

Most formulas give it two ranges. With one range it simply adds the values up, so a lone range is only useful when it holds a calculation, as in the examples with criteria below.

Example: total an order without a helper column

An office supply order lists quantities in column B and unit prices in column C.

12 × 6.49 + 3 × 58.90 + 25 × 0.85 + 6 × 4.75 = 304.33. In C6, =SUMPRODUCT(B2:B5,C2:C5) returns 304.33.

Read it as: multiply B2 by C2, B3 by C3 and so on down to row 5, then add the four results. To add a line, insert a row inside the list, above its last item, and both ranges grow to take it in.

Example: a weighted average

A shop bought the same item three times at different prices and wants the average cost per unit. Most of the stock came from the cheap January order, so a plain average of the three prices would overstate it.

The 400 units at $2.10 pull the average down to 2.24. AVERAGE(C2:C4) gives 2.47. In C5, =SUMPRODUCT(B2:B4,C2:C4)/SUM(B2:B4) returns 2.24.

SUMPRODUCT gives the total spent, $1,345, and dividing by the 600 units bought gives the cost per unit. The same pattern works for any weighted average: a grade weighted by credits, or a delivery time weighted by the number of orders.

SUMPRODUCT with multiple criteria

A comparison such as A2:A7="East" gives TRUE or FALSE for every row. Multiplying turns TRUE into 1 and FALSE into 0, so the rows that fail a test are multiplied by 0 and drop out of the total. That makes SUMPRODUCT a SUMIFS that can multiply columns as well.

Only rows 2 and 5 are East desks: 4 × 320 + 2 × 335. In D9, =SUMPRODUCT((A2:A7="East")*(B2:B7="Desk")*C2:C7*D2:D7) returns 1,950.

Each bracket is one test. Add another bracket for a third condition, and replace "East" with a cell reference such as F1 to let someone pick the region. Leave out the units and the price, as in =SUMPRODUCT((A2:A7="East")*(B2:B7="Desk")), and SUMPRODUCT counts the rows that pass, here 2.

SUMPRODUCT vs SUMIFS

SUMIFS adds up one column on the rows that meet its conditions, and it’s easier to read and faster on long lists. Use it when the amount to add is already in a column.

SUMPRODUCT is the one to use when the amount has to be calculated first, such as units times price, or when a condition compares two columns of the same row, as in =SUMPRODUCT(--(D2:D50>C2:C50)), which counts the rows where the actual in column D is over the budget in column C. SUMIFS can’t do either, because each of its conditions compares a column with one value.

Common mistakes

  • =SUM(B2:B5)*SUM(C2:C5) multiplies the total quantity by the total of the prices, which has no meaning and comes out far too high. SUMPRODUCT multiplies on each row first.
  • =SUMPRODUCT(C2:C7,D2:D6) gives #VALUE!, because one range has six rows and the other five. Every range must be the same size.
  • =SUMPRODUCT(A2:A7="East",C2:C7) returns 0. A TRUE or FALSE given straight to SUMPRODUCT counts as 0, so convert the test with -- in front of its brackets, =SUMPRODUCT(--(A2:A7="East"),C2:C7), or multiply it into the other range.
  • Text and empty cells count as 0 only when each range is its own argument. Multiplied inside one argument, as in =SUMPRODUCT(B2:B5*C2:C5), a cell holding text such as “n/a” turns the result into #VALUE!.
  • =SUMPRODUCT(A:A,B:B) makes Excel multiply more than a million rows, which slows a workbook down. Give it the rows that hold data, such as A2:A500.

Frequently asked questions

How do I use SUMPRODUCT with multiple criteria?

Put each test in brackets and multiply them by the column to add: =SUMPRODUCT((A2:A7="East")*(B2:B7="Desk")*C2:C7) adds the units on the rows that are both East and Desk. A row that fails any test is multiplied by 0.

What is the difference between SUMPRODUCT and SUMIFS?

SUMIFS adds up a column on the rows that meet its conditions. SUMPRODUCT can also multiply columns before adding them and compare two columns row by row, which SUMIFS can’t. For a plain conditional total, SUMIFS is simpler and faster.

How do I calculate a weighted average in Excel?

Multiply each value by its weight with SUMPRODUCT and divide by the total of the weights: =SUMPRODUCT(B2:B4,C2:C4)/SUM(B2:B4) averages the prices in column C weighted by the units in column B.

Why does SUMPRODUCT return 0?

Usually because a test such as A2:A7="East" was given as an argument of its own. SUMPRODUCT counts TRUE and FALSE as 0, so put -- in front of the brackets or multiply the test by another range. Also check for numbers stored as text, which count as 0 too.

Can SUMPRODUCT count cells?

Yes. Give it only the tests: =SUMPRODUCT(--(B2:B50="Late")) counts the rows that say Late, and =SUMPRODUCT((A2:A50="East")*(C2:C50>100)) counts the rows that pass both tests. COUNTIFS does the first job too, but only SUMPRODUCT can compare two columns of the same row.