You are on page 1of 7

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

1 of 7

Learn Microsoft Excel


Learn Microsoft Word
Learn Google Analytics
Contact Us

Home

Multiply two columns and add up


the results using SUMPRODUCT
Microsoft Excel
215

reddit

12

googleplus

19

11

The SUMPRODUCT function allows you to multiply two


columns or rows of numbers together (e.g. Quantity Sold and
Price Per Unit) and add the results of each individual
calculation together. Without the SUMPRODUCT function,
you would have to to create a third column or row in which
you write a formula to multiply the Quantity by Price for each
entry in your data, and then write another formula to find the
sum of all of those numbers. You can also use
SUMPRODUCT with one or multiple criteria, whereby
SUMPRODUCT will only operate on rows that meet the
criteria you define.
This lesson shows you how to use SUMPRODUCT to do all this, with just one
formula.
Scenarios where SUMPRODUCT is useful include:
Finding the total sales for all products, where you have Quantity Sold in one
column and Price per Unit in another.
Finding the total sales
for all products, but
only include those
sales for a specific City
(i.e. specify criteria for
SUMPRODUCT)
Finding the total sales
for all products, but
only include those
sales for a specific City
and Day (i.e. specify
multiple criteria for
SUMPRODUCT)
We'll cover examples of all three scenarios in this lesson.

SUMPRODUCT Syntax
The syntax of the SUMPRODUCT function is as follows:
=SUMPRODUCT(array1, [array2], [array3],...)
where array1 is the data in the first column, array2 is the data in the second
column and so on.

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

2 of 7

Some points to note:


You only need array1 for the function to work BUT if you only have array1
then SUMPRODUCT works the same way as SUM
Array2 and Array3 are both optional. In fact, you can have 255 arrays in
one SUMPRODUCT formula
However many arrays
you have, they must all
be the same shape.
You can't have array1
containing 43 cells in a
column, and array2
having only 42 cells Excell will return a
#VALUE error.
If any cells have text in
them, the
SUMPRODUCT
functions treats them
as containing zeros.
As we will see later, you can incorporate a logical test into each array value
to emulate the way that SUMIF or SUMIFS works.

Using SUMPRODUCT in a simple example.


Let's look at how to use SUMPRODUCT in a simple example. This is how most
people use SUMPRODUCT.
In this example, we'll use the following example where we want to find the
total value of sales for Monday:

As you can see, we have a range of products on sale at different unit prices.
Without SUMPRODUCT, we would have to add a new column to find the
sales for each product, and then add up the results of that column to find
total sales.
In this case, we'll enter the SUMPRODUCT formula in a cell below the table:

As shown here, the formula is =SUMPRODUCT(C5:C14,D5:D14). As you


can see, the formula includes two arrays:
An array (range of cells) that contains the quantity sold.
An array that contains the unit price
Our SUMPRODUCT formula works by multiplying the quantity by the unit
price for each row, and then returning the total for all rows in our array.
Bear in mind that this is a simple example that only uses two arrays - quantity
and price - to find the result we want. It's worth remembering at this point that
we can use more than two arrays if we wanted to.

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

3 of 7

Using SUMPRODUCT with criteria


Let's now expand our simple example. Let's say we want to specify some
criteria for the SUMPRODUCT function so it only adds up the sum of some of
the rows. In other words, we'll use SUMPRODUCT to find a subtotal of our
data based on our criteria.
Let's say we have another sales report for Green Widgets which breaks
down our sales by city as well as by day, as shown here:

We would like to find the sales of Green Widgets for St Louis.


In other words, we want to use SUMPRODUCT to find the value of sales
of Green Widgets, with the additional criterion that we want to
include only those sales of Green Widgets made in St Louis.
We can expand the SUMPRODUCT function by changing one of the arrays
to include a test to see if the City is St Louis, as show here:

Let's look more closely at this formula, =SUMPRODUCT(D5:D14,E5:E14*


(B5:B14=D16)). As in the previous example, we have two arrays:
The first array, D5:D14, is the same, and contains the data for quantity
sold.
The second array, E5:E14, is different. It contains the unit price, but it then
multiplies the value in the Unit Price column by a logical formula,
B5:B15=D16.
This logical formula works by comparing the City value (column B) in each
row with the value in D16 (St Louis). If the value in the City colum is St
Louis, the logical formula returns 1, otherwise it returns 0.
Multiplying the price by the result of this logical formula by the
quantity sold for each row means that any row where the City is not St
Louis will have a value of zero when SUMPRODUCT adds up the
products of all the rows.
We have achieved our objective - we have used SUMPRODUCT with a
criteria of "City = St Louis". The result can be see in the field "Total Value
of Sales from St Louis.
You can download the spreadsheet we used for this example here.
You can read more about logical formulas in our lesson Using logical
operators and functions in Excel
It's important to note that it doesn't matter where in our formula we use the
logical formula to check if the City value is St Louis. We used Price, but
using Quantity would have yielded the same result. Here's what that formula
looks like::
=SUMPRODUCT(D5:D14*(B5:B14=D16),E5:E14)
Using SUMPRODUCT with criteria in this way allows us to find the answer we
want using a single formula. The alternative approach would be to add another
column in which we calculate the sales for each row by multiplying Quantity
Sold by Price. We could then use the SUMIF function to add up the numbers in
that column that match our criteria that the city must equal St Louis. As you
can imagine, this requires more work than using the SUMPRODUCT function
with a criterion as we have seen it here. You can learn more about SUMIF in
this lesson: Using SUMIF to add up cells in Excel that meet certain criteria
In our next example, we'll look at how we could use more than one criteria with
SUMPRODUCT.

Using SUMPRODUCT with multiple criteria


For our next example, let's extend our example to have SUMPRODUCT
emulate the SUMIFS function. SUMIFS allows you to add up a row or column
of numbers, but only include those values where two or more criteria are
satisfied. You can read more about the SUMIFS function in this lesson: Use
SUMIFS to sum cells that match multiple criteria in Excel.
In this case, we would like to find the total value of sales for Green Widgets
sold in St Louis on Tuesday:

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

4 of 7

Our formula now looks lie this: =SUMPRODUCT(D5:D14*


(A5:A14=D17),E5:E14*(B5:B14=D16)) so that we are only :
The first array, D5:D14*(A5:A14=D17), will return the quantity sold if the
Day is Tuesday (i.e. the value in D17), or zero if the day is not Tuesday.
The second array, E5:E14*(B5:B14=D16), will return the unit price if the
City is St Louis (i.e. the value in D16), or zero if the city is not St Louis.
In other words, only rows that include Day = Tuesday AND City = St Louis
will be included in our total.
Finally, if you wanted to find the total value of sales for Green Widgets sold
in St Louis OR Chicago on any day, you could use this formula:
=SUMPRODUCT(--((B5:B14="Chicago")+(B5:B14="St
Louis")),D5:D14,E5:E14)
This formula checks to see if the City column contains Chicago or St Louis
and returns 1 if either are found, and 0 if neither are found. This result is
multiplied by the Quantity and Price columns to give the result.

Summary of this SUMPRODUCT lesson


In this lesson we looked at how SUMPRODUCT can save a lot of time when
trying to summarise data in a spreadsheet. Specifically, we were able to use it
to write one formulat that will find the total sales in a data table that includes
Quantity Sold and Unit Price, without having to create a new column to find
the total sales value for each row.
We also looked at how to use SUMPRODUCT with one or more criteria to
find the total sales in our example, but only for those rows that met the criteria
we specified. In our examples, we first found the total for all rows that matched
a certain City, and for those rows that matched a certain City AND Day. We
also considered the use of SUMIF as an alternative to using SUMPRODUCT,
and realised that it would involve writing multiple formulas to achieve the same
result.

If you have any questions about how to use SUMPRODUCT in


other ways, or you have feedback on this lesson, feel free to
add a comment below.

Want to learn more? Try these lessons:


Using SUMIF to add up cells in Excel that meet certain criteria
Use SUMIFS to sum cells that match multiple criteria in Excel
Calculate the sum of a column of numbers in Excel
Rounding numbers in Excel
215

reddit

12

googleplus

19

11

Add new comment

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

5 of 7

Our Comment Policy.


We welcome your comments and questions about this lesson. We don't welcome spam. Our readers get a lot of value
out of the comments and answers on our lessons and spam hurts that experience. Our spam filter is pretty good at
stopping bots from posting spam, and our admins are quick to delete spam that does get through. We know that bots
don't read messages like this, but there are people out there who manually post spam. I repeat - we delete all spam,
and if we see repeated posts from a given IP address, we'll block the IP address. So don't waste your time, or ours.
Add a comment to this lesson

Comments on this lesson


THIS POST REALLY HELPED ME!
Submitted by CANDIE on Tue, 04/14/2015 - 11:03
THIS POST REALLY HELPED ME! THANK YOU!
reply

How do I edit the value of a product OUTSIDE of the critera


Submitted by Sean on Wed, 05/20/2015 - 21:58
So basically I have made a spreadsheet comprising + and - figures. I have also added criteria's "W" and "L" that I
wish to make 2 separate conversions for EACH outcome.
For every "L" marked in column M, I want to subtract %5 from the number in column N of that same row to display in
column P. For every "W" marked in column M (i.e NOT satisfying the critera) I want the number to stay THE SAME as
N, but displayed in column P.
I have put together a formula I found in the comments under the SUMIF function, but have converted it to
SUMPRODUCT.
Here is the table example:
M--------------------N-----------------P
Win/Lose_____Total_____Commission
W___________9.80_____0.00 (needs to be 9.80(N2))
L____________14.32____13.60
L____________5.00_____4.75
W___________9.75_____0.00 (needs to be 9.75(N5))
This is how the formula currently stands:
{=SUMPRODUCT(--(LEFT(M2,1)="L"),N2*(1-5%))}
Now, my main problem here is that I already have a pre-filled spreadsheet with all the correct conversions, and I am
looking to continue without having to do it all manually. Currently with this formula, all cells in column P (marked with
"W" from column M) are being converted to 0, erasing the previous calculated result of another formula in column N.
How do I change the "0" outcomes to display the calculation from column N?
Also, I wish for the formula to continue indefinately. I've tried using M:M but it doesnt seem to work. I'm using AutoFill
for now, is there a better way of doing this?
Any help would be great!
Thanks
reply

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

6 of 7

So basically I have made a


Submitted by Sean on Wed, 05/20/2015 - 22:09
So basically I have made a spreadsheet comprising + and - figures. I have also added criteria's "W" and "L" that I
wish to make 2 separate conversions for EACH outcome.
For every "L" marked in column M, I want to subtract %5 from the number in column N of that same row to display in
column P. For every "W" marked in column M (i.e NOT satisfying the critera) I want the number to stay THE SAME as
N, but displayed in column P.
I have put together a formula I found in the comments under the SUMIF function, but have converted it to
SUMPRODUCT.
Here is the table example:
M--------------------N-----------------P
Win/Lose_____Total_____Commission
W___________9.80_____0.00 (needs to be 9.80(N2))
L____________14.32____13.60
L____________5.00_____4.75
W___________9.75_____0.00 (needs to be 9.75(N5))
This is how the formula currently stands:
{=SUMPRODUCT(--(LEFT(M2,1)="L"),N2*(1-5%))}
Now, my main problem here is that I already have a pre-filled spreadsheet with all the correct conversions, and I am
looking to continue without having to do it all manually. Currently with this formula, all cells in column P (marked with
"W" from column M) are being converted to 0, erasing the previous calculated result of another formula in column N.
How do I change the "0" outcomes to display the calculation from column N?
Also, I wish for the formula to continue indefinately. I've tried using M:M but it doesnt seem to work. I'm using AutoFill
for now, is there a better way of doing this?
Any help would be great!
Thanks
reply
PT 05 M

Ar t icle

I nd epe nd ent L ear nin g

SHARE
Like Sign Up to see what your friends like.

Tweet

Additional Info

Download worked examples

23/10/2015 15:00

Multiply two columns and add up the results using SUMPRODUCT | Mu... http://fiveminutelessons.com/learn-microsoft-excel/multiply-two-column...

7 of 7

SUMPRODUCT examples from this lesson

Similar lessons
Using SUMIF to add up cells in Excel that meet
certain criteria
Use SUMIFS to sum cells that match multiple criteria
in Excel
Calculate the sum of a column of numbers in Excel
Rounding numbers in Excel

Join our mailing list


Get smarter in just five minutes! Join our mailing list (it's
free!) and get updates whenever new lessons are added!

Email Address *

First Name *

Subjects I'm interested in


I want to learn more about:
Microsoft Excel
Microsoft Word
Google Analytics
Google Adwords
Facebook Marketing
Sign me up!

Five Minute Lessons


701 likes

Five Minute Lessons


August 13

We really like the new Office 2016 for Mac but ...
the Autoupdate feature has revealed a major flaw.
Check out the file sizes of the updates for these
Microsoft Office products. See how big the Office
2011 update is compared to each of the other
updates? There's something wrong here...

Ads by Google

Excel Formulas
Formula to Calculate
Microsoft Excel How To

Downloading

Downloads

Free work from home

Free budget spreadsheet

privacy policy

23/10/2015 15:00

You might also like