Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS

Excel Tutorial

Excel HOME Excel Introduction Excel Get Started Excel Overview Excel Syntax Excel Ranges Excel Fill Excel Move Cells Excel Add Cells Excel Delete Cells Excel Undo Redo Excel Formulas Excel Relative Reference Excel Absolute Reference Excel Arithmetic Operators Excel Parentheses Excel Functions

Excel Formatting

Excel Formatting Excel Format Painter Excel Format Colors Excel Format Fonts Excel Format Borders Excel Format Numbers Excel Format Grids Excel Format Settings

Excel Data Analysis

Excel Sort Excel Filter Excel Tables Excel Conditional Format Excel Highlight Cell Rules Excel Top Bottom Rules Excel Data Bars Excel Color Scales Excel Icon Sets Excel Manage Rules (CF) Excel Charts

Excel PivotTables

Excel PivotTable Intro Excel Create PivotTable Excel PivotTable Values Excel PivotTable Filter Excel PivotTable Group Excel Calculated Field Excel PivotChart

Excel Case

Case: Poke Mart Case: Poke Mart, Styling

Excel Functions

AND AVERAGE AVERAGEIF AVERAGEIFS CONCAT COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS DATEDIF FILTER HLOOKUP IF IFERROR IFS INDEX INDEX MATCH LEFT LEN LOWER MATCH MAX MEDIAN MID MIN MODE NETWORKDAYS NPV OR PROPER RAND RIGHT ROUND SORT STDEV.P STDEV.S SUBSTITUTE SUM SUMIF SUMIFS SUMPRODUCT TEXTJOIN TODAY TRIM UNIQUE UPPER VLOOKUP XLOOKUP XOR

Excel How To

Convert Time to Seconds Difference Between Times NPV (Net Present Value) Remove Duplicates

Excel Cert

Excel Certificate

Excel Examples

Excel Exercises Excel Syllabus Excel Study Plan Excel Training

Excel References

Excel Keyboard Shortcuts


Excel SUMPRODUCT Function


Share

SUMPRODUCT Function

The SUMPRODUCT function is a premade function in Excel, which multiplies ranges item by item, and adds up the results.

For example, it can multiply the quantity by the price on every row of an order, and add it all up to an order total, in one formula.

It is typed =SUMPRODUCT and has the following parts:

=SUMPRODUCT(array1, [array2], [array3], ...)

Note: The different parts of the function are separated by a symbol, like comma , or semicolon ;

The symbol depends on your Language Settings.

Array1: The first range, for example a column of quantities.

Array2, array3, ...: Optional. More ranges to multiply with the first one.

SUMPRODUCT multiplies the first cells of all the ranges, then the second cells, and so on. Then it adds up all the results.

Note: All the ranges must have the same size. If one range has more rows than the others, SUMPRODUCT returns #VALUE!.

How to use the SUMPRODUCT function:

  1. Select a cell (H2)
  2. Type =SUMPRODUCT
  3. Double click the SUMPRODUCT command
  4. Mark the first range (C2:C8)
  5. Type (,)
  6. Mark the second range (D2:D8)
  7. Hit enter

Let's have a look at an example!

This is one order from the Poke Mart. The categories and prices are from the Poke Mart product list. Copy it and paste it into cell A1:

Example data

ABCD
1ItemCategoryQtyPrice
2Poke BallBalls10200
3Great BallBalls5600
4Ultra BallBalls21200
5PotionMedicine8300
6Super PotionMedicine3700
7ReviveMedicine11500
8AntidoteStatus Healers4100

Type the label Order Total in G2.

Use SUMPRODUCT to multiply Qty by Price on every row, and add up the results:

ABCDEFGH
1ItemCategoryQtyPrice
2Poke BallBalls10200Order Total13800
3Great BallBalls5600
4Ultra BallBalls21200
5PotionMedicine8300
6Super PotionMedicine3700
7ReviveMedicine11500
8AntidoteStatus Healers4100
=SUMPRODUCT(C2:C8, D2:D8)

SUMPRODUCT calculates 10*200 + 5*600 + 2*1200 + 8*300 + 3*700 + 1*1500 + 4*100. The order total is 13800.

Without SUMPRODUCT, you need a helper column. Here, E2 has the formula =C2*D2, filled down to E8, and E9 adds up the line totals with =SUM(E2:E8):

ABCDE
1ItemCategoryQtyPriceLine Total
2Poke BallBalls102002000
3Great BallBalls56003000
4Ultra BallBalls212002400
5PotionMedicine83002400
6Super PotionMedicine37002100
7ReviveMedicine115001500
8AntidoteStatus Healers4100400
9Total13800

The result is the same. SUMPRODUCT does it in one cell, without the helper column.



SUMPRODUCT with a Condition

To add up only some of the rows, add a condition as one of the ranges.

Find the total for the Balls category. Type the label Balls Total in G3:

GH
2Order Total13800
3Balls Total7400
=SUMPRODUCT(--(B2:B8="Balls"), C2:C8, D2:D8)

This is how it works:

B2:B8="Balls" checks every category, and gives a list of TRUE and FALSE.

SUMPRODUCT only multiplies numbers, and treats TRUE and FALSE as 0. The double minus -- turns them into real numbers first: TRUE becomes 1, and FALSE becomes 0.

The first minus turns TRUE into -1, and the second minus turns it back into 1.

Rows that are not Balls are multiplied by 0, so they add nothing to the total:

ItemCategoryB2:B8="Balls"--Qty * PriceResult
Poke BallBallsTRUE120002000
Great BallBallsTRUE130003000
Ultra BallBallsTRUE124002400
PotionMedicineFALSE024000
Super PotionMedicineFALSE021000
ReviveMedicineFALSE015000
AntidoteStatus HealersFALSE04000
Sum7400

The total for Balls is 2000 + 3000 + 2400 = 7400.

Note: If you leave out the --, the condition counts as 0 on every row, and the result is 0.

Multiply Instead of --

Any calculation turns TRUE and FALSE into 1 and 0. So you can also multiply the condition with the other ranges. This formula gives the same result, 7400:

=SUMPRODUCT((B2:B8="Balls")*C2:C8*D2:D8)

You may also see (B2:B8="Balls")*1. Multiplying by 1 works like the double minus.


Two Conditions

Multiply two conditions to require both. A row only counts if both conditions are TRUE, because 1*1 is 1, and anything times 0 is 0.

Find the total for Balls where the Qty is 5 or more. Type the label Balls, Qty 5+ in G4:

GH
2Order Total13800
3Balls Total7400
4Balls, Qty 5+5000
=SUMPRODUCT((B2:B8="Balls")*(C2:C8>=5), C2:C8, D2:D8)

Poke Ball (Qty 10) and Great Ball (Qty 5) match both conditions. Ultra Ball is a Ball, but the Qty is only 2. The total is 2000 + 3000 = 5000.


SUMPRODUCT or SUMIFS?

If your table already has a column with the line totals, like column E in the helper example, SUMIFS can add them up with conditions:

=SUMIFS(E2:E8, B2:B8, "Balls")

SUMPRODUCT is useful when the numbers must be multiplied first, and you do not want a helper column.

See also SUM, SUMIF and the multiplication operator.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.