Excel functions · Conditional math

SUMPRODUCT function in Excel

SUMPRODUCT multiplies matching items in two or more ranges and adds up the results, such as quantity times unit price across an invoice. With conditions written as (range="value"), it also does sums and counts with AND or OR logic that SUMIFS can't.

Last reviewed

Syntax

=SUMPRODUCT(array1, [array2], [array3], ...)
array1required
The first range or array.
array2, ...optional
More ranges the same size as array1, up to 255 in all. Each row's values are multiplied, then summed.
  • A test like (D2:D6="North") gives TRUE/FALSE; multiplying turns them into 1 and 0.
  • Use -- in front of a single test to turn TRUE/FALSE into numbers: SUMPRODUCT(--(B2:B6>=10)).
  • Multiply tests for AND; add them, then compare with >0, for OR.

Which versions have SUMPRODUCT

Every current Excel version: Microsoft 365, Excel for the web, Excel 2024, 2021, 2019 and 2016, on Windows and Mac.

SUMPRODUCT availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019Yes
Excel 2016Yes

Google Sheets

Google Sheets has SUMPRODUCT with the same arguments and the same TRUE/FALSE tricks.

Examples

The examples use this sample sheet.

Order lines (A1:D6)
RowABCD
1ItemQtyUnit priceRegion
2Notebook123.50North
3Pen pack304.00South
4Stapler511.00North
5Folder401.25South
6Desk tray89.50North
  1. 1.Order total (quantity × price)

    =SUMPRODUCT(B2:B6, C2:C6)

    Result: 343

    42 + 120 + 55 + 50 + 76.

  2. 2.Total for one region

    =SUMPRODUCT((D2:D6="North")*B2:B6*C2:C6)

    Result: 173

    Only North lines count: 42 + 55 + 76.

  3. 3.Count lines with 10 or more units

    =SUMPRODUCT(--(B2:B6>=10))

    Result: 3

    Notebook (12), Pen pack (30) and Folder (40).

Common errors and fixes

SUMPRODUCT errors, causes and fixes
ErrorWhy it happensFix
#VALUE!The arrays are different sizes, or a cell multiplied with * holds text.Use same-size ranges, and clean text out of numeric columns.
Slow workbookWhole-column references such as A:A make SUMPRODUCT compute over a million rows.Use exact ranges or an Excel table.

Do it with GPTExcel

Skip writing SUMPRODUCT by hand

Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.

your-file.xlsx

Calculate revenue as quantity times unit price for each region in my order lines.

Done. I used SUMPRODUCT on your sheet and checked the results against your data.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

SUMPRODUCT questions

When should I use SUMPRODUCT instead of SUMIFS?
Use SUMIFS for plain AND conditions; it's faster and easier to read. Use SUMPRODUCT when you need OR logic, a weighted total, or a condition that's a calculation, such as a month taken from a date column.
What does the double minus (--) do in SUMPRODUCT?
It turns TRUE and FALSE into 1 and 0 so SUMPRODUCT can add them. =SUMPRODUCT(--(B2:B6>=10)) counts the rows that pass the test.

Skip the formula hunt

Upload a spreadsheet and ask in plain English. Free plan, no credit card.

Start free