Sie sind auf Seite 1von 17

Excel-Spreadsheet-Authors.

com
The Excel Sumproduct Quick Start Guide©

THE EXCEL SUMPRODUCT


QUICK START GUIDE

HOW TO TURBOCHARGE YOUR EXCEL REPORTING SKILLS USING

SUMPRODUCT CRITERIA

John Franco

www.Excel-Spreadsheet-Authors.com 2 | Page
The Excel Sumproduct Quick Start Guide©

The Excel SUMPRODUCT Quick Start Guide©

by John Franco

© 2010 by Excel-Spreadsheet-Authors.com

Notice of Rights

All rights reserved. No part of this book may be reproduced, stored in a


retrieval system, or transmitted in any form or by any means, without the
prior written permission of the publisher.

Share/Email/Print this eBook for FREE


Pass it along given that you make no changes to its
content or digital format.

If you want to sell this book or use it for commercial


purposes, please Contact me

Notice of Liability

The author and publisher have made every effort to ensure the accuracy
of the information herein. However, the information contained in this book
is sold without warranty, either express or implied. Neither the authors
and Excel-Spreadsheet-Authors.com, nor its dealers or distributors, will
be held liable for any damages to be caused either directly or indirectly by
the instructions contained in this book, or by the software or hardware
products described herein.

Trademark Notice

Rather than indicating every occurrence of a trademarked name as such,


this book uses the names only in an editorial fashion and to the benefit of
the trademark owner with no intention of infringement of the trademark.

Cover image© Kurhan - Fotolia.com

www.Excel-Spreadsheet-Authors.com 3 | Page
The Excel Sumproduct Quick Start Guide©

TOC
TOC ................................................................................................ 4

Introduction ..................................................................................... 5

7 Hidden formulas of Excel SUMPRODUCT ........................................... 8

1. Conditional Count single (COUNTIF).......................................... 9

2. Conditional Count date range (COUNTIF date) ........................... 9

3. Conditional Count multiple (COUNTIFS)..................................... 9

4. Conditional Sum single (SUMIF) ............................................... 9

5. Conditional sum case sensitive (SUMIF case sensitive) ................ 9

6. Conditional Sum multiple (SUMIFS) ........................................ 10

7. Vlookup multiple criteria with numbers.................................... 10

Bonus Example 1 – LOOK UP a Case Sensitive Text Using SUMPRODUCT


.................................................................................................... 11

Bonus Example 2 – LOOK UP a Text and a Number Located in Two Index


Columns Using SUMPRODUCT .......................................................... 12

Bonus Example 3 – LOOK UP a Month Using SUMPRODUCT.................. 13

Bonus Example 4 - LOOK UP the Amount of a Given Item that Meets N


Criteria Using SUMPRODUCT ............................................................ 14

Backend List Troubleshooting for SUMPRODUCT ................................. 15

About John .................................................................................... 17

www.Excel-Spreadsheet-Authors.com 4 | Page
The Excel Sumproduct Quick Start Guide©

Introduction
At first glance, the Excel SUMPRODUCT function can only help you
multiplying corresponding arrays, and returning the sum of those
products into a cell.

For example, in the following table the formula on F1 is:


=SUMPRODUCT(B2:B6,C2:C6).

The truth be known, its capabilities go beyond a single sum of the


products.

You will be impressed once you know the potential of the not-so-
exploited SUMPRODUCT function.

With a few tricks, here is what else you can do with it…

1. Conditional Count single (COUNTIF)

2. Conditional count date range (COUNTIF date)

3. Conditional Count multiple (COUNTIFS)

4. Conditional Sum single (SUMIF)

5. Conditional Sum case sensitive (SUMIF case sensitive)

6. Conditional Sum multiple (SUMIFS)

7. Vlookup multiple criteria with numbers

What makes this function so especial?

If you take into account the Excel help…It says that the syntax is
SUMPRODUCT(array1,array2,array3, ...) where: Array1, array2, array3,
... are 2 to 255 arrays whose components you want to multiply and then
add.

Nothing special, right? Apparently, the SUMPRODUCT function just


prevents you from writing the formula =(A1*B1+A1*B2-

www.Excel-Spreadsheet-Authors.com 5 | Page
The Excel Sumproduct Quick Start Guide©

A3*B3…+A100*B100) so you write this simple one:


=SUMPRODUCT(A1:A100,B1:B100)

That is just the tip of the iceberg…

I will show you the magic now:

The syntax is: SUMPRODUCT(array1,array2,array3, …) but it can take the


form: SUMPRODUCT((criteria column 1=lookup value 1)*(criteria column
2=lookup value 2)* attribute column) You can replace the logical operator
(=) by the following operators: <. <=, >, >=, <> and even expand the
power.

What does this mean?

The formula will retrieve the cells of the attribute column after all criteria
columns are true: SUMPRODUCT(1*1*attribute)

If one condition is false then you would have:


SUMPRODUCT(1*0*attribute) and no cell in the attribute column is
computed.

I will show some examples below…

=SUMPRODUCT((EXACT($B$2:$B$7,A2))*$C$2:$C$7)

=SUMPRODUCT((MONTH($B$2:$B$7)=A2)*$C$2:$C$7)

=SUMPRODUCT(($A$2:$A$8>=DATEVALUE("05/01/2009"))*
($A$2:$A$8<=DATEVALUE("05/31/2009"))*($D$2:$D$8=B$14)*$
B$2:$B$8)

=SUMPRODUCT(($A$2:$A$8>=10000)*
($A$2:$A$8<=50000)*($D$2:$D$8=B$14)*$B$2:$B$8)

Remember that the attribute column (bold array) can only be numeric.

You can reference the criteria in several ways:

Data Referenced Notes


type
Text =SUMPRODUCT($E$2:$E$5=A2 You can replace = by the following
operators: <. <=, >, >=, <>
Number =SUMPRODUCT($E$2:$E$5=A2 You can replace = by the following
operators: <. <=, >, >=, <>
Date =SUMPRODUCT($E$2:$E$5=A2 You can replace = by the following
operators: <. <=, >, >=, <>

www.Excel-Spreadsheet-Authors.com 6 | Page
The Excel Sumproduct Quick Start Guide©

Or…

You can hard code the criteria in several ways:

Data Hard coded Notes


type
Text =SUMPRODUCT($E$2:$E$5="Susan", …) Don't type Susan (without quotes),
Excel will interpret it as a named
range.
You can replace = by the following
operators: <. <=, >, >=, <>
Number =SUMPRODUCT($E$2:$E$5=1000, …) Don’t put quotes to numbers.
You can replace = by the following
operators: <. <=, >, >=, <>
=SUMPRODUCT($E$2:$E$5=10%, …) You can also use
=SUMPRODUCT($E$2:$E$5=0.1, …).
You can replace = by the following
operators: <. <=, >, >=, <>
Date =SUMPRODUCT($E$2:$E$5=40091, …) You can enter a number that
represents a date serial number.
You can replace = by the following
operators: <. <=, >, >=, <>
=SUMPRODUCT($E$2:$E$5=DATEVALUE( You can replace = by the following
"10/5/2009"), …) operators: <. <=, >, >=, <>
=SUMPRODUCT($E$2:$E$5=DATE(2009,1 You can replace = by the following
0,5),H5:I7,2,0),...) operators: <. <=, >, >=, <>

Conclusion:

Add SUMPRODUCT to your toolbox and you will have one single function
that allows you to do multiple things.

Moreover, you will have almost the same functionality of Array Formulas
without pressing the CTRL + SHIFT + ENTER.

7 functions in one make SUMPRODUCT really an Excel Army Swiss


knife

John Franco

www.Excel-Spreadsheet-Authors.com

www.Excel-Spreadsheet-Authors.com 7 | Page
The Excel Sumproduct Quick Start Guide©

7 Hidden formulas of Excel SUMPRODUCT


Well, that’s been enough talking; let’s start with the real examples…

SUMPRODUCT will help you to work with Excel Tables that have multiple
and complicated criteria.

Let’s use the table below…

Again…the standard functionality of the SUMPRODUCT function is to sum


the products of the parallel arrays.

You can directly calculate the Total cost without inserting either column F
or formulas =D2*E2 and then =SUM(F2:F22).

Just use this formula: =SUMPRODUCT(D2:D22,E2:E22) that results in


$13,947.62.

Now, let’s see the 7 hidden formulas (all the examples refer to the above
table)…

www.Excel-Spreadsheet-Authors.com 8 | Page
The Excel Sumproduct Quick Start Guide©

1. Conditional Count single (COUNTIF)


How many orders belong to “Jones”?

=SUMPRODUCT(–(B2:B22=”Jones”)) that results in 5.

If you don’t use (–-) you will receive 0.

What does the double dash (–) mean?

It converts the TRUEs and FALSEs that result after evaluating the column
condition to 1s and 0s so they can be considered by SUMPRODUCT.

For example each time B2:B22=”Jones”

B2 = FALSEB3 = TRUE…

Then you convert those TRUE/FALSE to 1/0 so the formula can add them

See this SUMPRODUCT post for a great explanation

2. Conditional Count date range (COUNTIF date)


How many orders were made on 2005?

Use the formula: =SUMPRODUCT(–(YEAR(A2:A22)=2005)) and get the


result: 13.

The above formula is simpler than this one:


=COUNTIF(A2:A22,">="&DATEVALUE("01/01/2005"))-
COUNTIF(A2:A22,">"&DATEVALUE("12/31/2005"))

3. Conditional Count multiple (COUNTIFS)


How many orders of Pencils belong to “Jones”?

=SUMPRODUCT(–(B2:B22=”Jones”)*(–(C2:C22=”Pencil”))) that results in


2.

4. Conditional Sum single (SUMIF)


How much did “Jones” sell?

=SUMPRODUCT((B2:B22=”Jones”)*F2:F22) that results in 5,025.17

5. Conditional sum case sensitive (SUMIF case sensitive)


You can create a case sensitive
formula…=SUMPRODUCT(EXACT(B2:B22,”Smith”)*F2:F22) or
…=SUMPRODUCT(EXACT(B2:B22,”smith”)*F2:F22)

www.Excel-Spreadsheet-Authors.com 9 | Page
The Excel Sumproduct Quick Start Guide©

The above formulas will compute “Smith” and “smith” as separate entries.

6. Conditional Sum multiple (SUMIFS)


How much of Pencils did “Jones” sell?

=SUMPRODUCT((B2:B22=”Jones”)*(C2:C22=”Pencil”)*F2:F22) that
results in 658.58.

7. Vlookup multiple criteria with numbers


This works when your criterion returns one value, for example:

Search the number of units that Jones sold on 7/29/2006, the formula
would be this one…

=SUMPRODUCT((A2:A22=DATEVALUE(“7/29/2006″))*(B2:B22=”Jones”)
*D2:D22) that results in 21

Important reminder

Explore the 7 formulas in the provided .xls file (Excel-Sumproduct-Quick-


Start-Guide_7-formulas.xls). Practice and adapt the formulas to your
convenience.

Additionally; you can explore the bonus examples provided below

Excel-Sumproduct-Quick-Start-Guide_bonus-example-1.xls

Excel-Sumproduct-Quick-Start-Guide_bonus-example-2.xls

Excel-Sumproduct-Quick-Start-Guide_bonus-example-3.xls

Excel-Sumproduct-Quick-Start-Guide_bonus-example-4.xls

www.Excel-Spreadsheet-Authors.com 10 | P a g e
The Excel Sumproduct Quick Start Guide©

Bonus Example 1 – LOOK UP a Case Sensitive Text


Using SUMPRODUCT
The needles…

The haystack…

SUMPRODUCT((criteria
How to… column 1 = criteria
1)*attribute column)
At the Backend (haystack)

1. Prepare the table_array to be ready to lookup unique entries (see


backend troubleshooting in page 14)

At the Frontend (needle)

2. Write the formulas in B2 and B3 respectively:


=SUMPRODUCT((EXACT(Haystack!$B$2:$B$7,A2))*Haystack!$C
$2:$C$7)

Notes

SUMPRODUCT only retrieves numeric values. The array


Haystack!$C$2:$C$7 must be numeric or date only. When you use
the SUMPRODUCT formula with text arrays you will receive a #VALUE!
Error

Don’t forget to format the cells B2 and B3 as dates

www.Excel-Spreadsheet-Authors.com 11 | P a g e
The Excel Sumproduct Quick Start Guide©

Bonus Example 2 – LOOK UP a Text and a Number


Located in Two Index Columns Using
SUMPRODUCT
The needles…

The haystack…

How to…

At the Backend (haystack)

1. Prepare the table_array to be ready to lookup unique entries (see


backend troubleshooting in page 14)

At the Frontend (needle)

1. Write the formula in C2:


=SUMPRODUCT((Haystack!$A$2:$A$12=A2)*(Haystack!$B$2:$
B$12=B2)*Haystack!$E$2:$E$12)

Notes

SUMPRODUCT only retrieves numeric values. The array


Haystack!$E$2:$E$12 must be numeric or date only. When you use
SUMPRODUCT with text arrays you will receive a #VALUE! Error

www.Excel-Spreadsheet-Authors.com 12 | P a g e
The Excel Sumproduct Quick Start Guide©

Bonus Example 3 – LOOK UP a Month Using


SUMPRODUCT
The needle…

The haystack…

SUMPRODUCT((criteria
How to… column 1 = criteria
1)*attribute column)
At the Backend (haystack)

1. Prepare the table_array to be ready to lookup unique entries (see


backend troubleshooting in page 14)

At the Frontend (needle)

2. Write the formula in B2:


=SUMPRODUCT((MONTH(Haystack!$B$2:$B$7)=A2)*Haystack!
$C$2:$C$7)

Notes

You can use the formula:


=SUMPRODUCT((Haystack!$B$2:$B$7>=DATEVALUE("06/01/2
009"))*(Haystack!$B$2:$B$7<=DATEVALUE("06/30/2009"))*H
aystack!$C$2:$C$7)

You can use the functions: YEAR, MONTH, DAY, WEEKDAY

www.Excel-Spreadsheet-Authors.com 13 | P a g e
The Excel Sumproduct Quick Start Guide©

Bonus Example 4 - LOOK UP the Amount of a Given


Item that Meets N Criteria Using SUMPRODUCT
The needle…

The haystack…

SUMPRODUCT((criteria
How to… column 1 = criteria
1)*attribute column)
At the Backend (haystack)

1. Prepare the table to be ready to lookup quantities (see backend


troubleshooting in page 15)

At the Frontend (needle)

2. Write the formulas in C2 and C3 respectively:


=SUMPRODUCT((Haystack!$D$2:$D$8=A2)*(Haystack!$A$2:$A
$8<=B2)*Haystack!$B$2:$B$8)

Notes

Always cross check with a total sum (see C4 in the frontend). You can
use a Filter to sum with multiple criteria (sometimes the items are not
properly taken into account due to spaces or wrong spelling)

For more techniques see: http://www.excel-spreadsheet-


authors.com/sumif-multiple-7-ways.html

www.Excel-Spreadsheet-Authors.com 14 | P a g e
The Excel Sumproduct Quick Start Guide©

Backend List Troubleshooting for SUMPRODUCT


Apply the next guidelines to the lookup array (index column) when you
use SUMPRODUCT as a lookup formula

Delete duplicates from the index column. For example, you cannot
have more than one “Susan” in the Name column. Here are several
options to delete duplicates:

o Remove Duplicates in Excel 2007 by going to:


Design>Tools>Remove Duplicates

o Remove Duplicates manually in Excel 2007 by going to:


Home>Styles>Conditional formatting>Highlight Cells
Rules>Duplicate values

o Remove duplicates in Excel 2003 by going to:


Data>Filter>Advanced Filter>Unique records only

Be sure that the Index column is the leftmost one for VLOOKUP
Formulas. To move it proceed this way: Cut the column, right click
on the leftmost column header and choose Insert Cut Cells

Delete leading and trailing spaces from the index column. Use the
function TRIM or the Text to Columns command

Delete nonprintable characters from the index column. Use the


function CLEAN

Check the spelling of the index column entries and the


lookup_value, for example: “Susam” instead of “Susan”

Format the index column according to the data it contains. For


example: numbers must be free of suffixes like m for meters, “ for
inches, etc. they must not be stored as texts. Dates must be
entered as serial numbers and not as 12SEPT09, 31/01/2009
(instead of 01/31/2009), etc

www.Excel-Spreadsheet-Authors.com 15 | P a g e
The Excel Sumproduct Quick Start Guide©

I am John Franco - of Ecuador South America. I invite you to visit me


at my blog www.Excel-Spreadsheet-Authors.com where we can become
better acquainted. I will show you many amazing truths of Excel.

John Franco

Excel-Spreadsheet-Authors.com

www.Excel-Spreadsheet-Authors.com 16 | P a g e
The Excel Sumproduct Quick Start Guide©

About John
John Franco is a native of Ecuador, he is a Civil Engineer
and a Bachelor in Applied Linguistics with focus on creating
systems for work, his long term objective in life is helping
others to gain momentum in the application of ideas.

For over seven years, he worked as a Civil Engineer


for Norberto Odebrecht Construction Company (the 44th largest
construction contracting firm from around the world according to
Engineering News Record 2008).

During that time, He had an Excel Maven Boss; Nilton Teti, one of
those old-time-Excel-geniuses who makes precious models, uses just the
keyboard and hates BI corporate packages. His almost “religious fervor”
for Excel, and his amazing knowledge, was the source of John’s great
interest in Spreadsheets.

During all these years John really experienced the professional benefits of
using Excel to accomplish his duties; he says to you that: “being skilled
in Excel gives you a tremendous advantage at the office and in
your career!”

Having always been very entrepreneurial in his nature, he quit his job at
Norberto Odebrecht in order to devote his full passion and knowledge of
advanced Excel methods to others around the world who can benefit from
it.

His first entrepreneurial initiative is the site

www.Excel-Spreadsheet-Authors.com; a blog dedicated to Mid/Advanced


Excel users so they can polish their skills to reach higher productivity and
clarity.

Email him at: john@excel-spreadsheet-authors.com

www.Excel-Spreadsheet-Authors.com 17 | P a g e

Das könnte Ihnen auch gefallen