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.
| Version | Has it |
|---|---|
| Microsoft 365 (Windows and Mac) | Yes |
| Excel for the web | Yes |
| Excel 2024 | Yes |
| Excel 2021 | Yes |
| Excel 2019 | Yes |
| Excel 2016 | Yes |
Google Sheets
Google Sheets has SUMPRODUCT with the same arguments and the same TRUE/FALSE tricks.
Examples
The examples use this sample sheet.
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Item | Qty | Unit price | Region |
| 2 | Notebook | 12 | 3.50 | North |
| 3 | Pen pack | 30 | 4.00 | South |
| 4 | Stapler | 5 | 11.00 | North |
| 5 | Folder | 40 | 1.25 | South |
| 6 | Desk tray | 8 | 9.50 | North |
1.Order total (quantity × price)
=SUMPRODUCT(B2:B6, C2:C6)Result: 343
42 + 120 + 55 + 50 + 76.
2.Total for one region
=SUMPRODUCT((D2:D6="North")*B2:B6*C2:C6)Result: 173
Only North lines count: 42 + 55 + 76.
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
| Error | Why it happens | Fix |
|---|---|---|
| #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 workbook | Whole-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.
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.
- Written for your platform and version
- Checked against your actual data
- Newest functions looked up in official docs
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