Solved

Using Sumproduct to count all rows which meet two conditions

Posted on 2010-09-09
9
351 Views
Last Modified: 2012-08-14
Hi Experts,

I am trying to use Sumproduct to count all rows in a worksheet named 'Meets Criteria - deduped' which meet two conditions:

where the value in column A = "Y"
where the value in column E = "7036"

Here is my code:
=SUMPRODUCT(--('Meets Criteria - deduped'!E2:E4000=7036),--('Meets Criteria - deduped'!A2:A4000,"Y"))

Excel tells me I have an error.  Can you help me fix this statement?

Thank-you!
0
Comment
Question by:shamrin
9 Comments
 
LVL 45

Accepted Solution

by:
patrickab earned 125 total points
ID: 33638969
Try,

=SUMPRODUCT(('Meets Criteria - deduped'!E1:E4=7036)*('Meets Criteria - deduped'!A1:A4="Y"))
0
 
LVL 24

Expert Comment

by:broomee9
ID: 33638970
Try this:
=SUMPRODUCT(--('Meets Criteria - deduped'!E2:E4000=7036)*('Meets Criteria - deduped'!A2:A4000="Y"))
0
 
LVL 45

Expert Comment

by:patrickab
ID: 33638978
Oops, should have been:

=SUMPRODUCT(('Meets Criteria - deduped'!E1:E4000=7036)*('Meets Criteria - deduped'!A1:A4000="Y"))
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 33639028
No points for this...

If that 7036 is truly a text value, you may need:

=SUMPRODUCT(('Meets Criteria - deduped'!E1:E4000="7036")*('Meets Criteria - deduped'!A1:A4000="Y"))
0
 
LVL 2

Expert Comment

by:Hossy
ID: 33639226
I'll start off saying I've never used SUMPRODUCT, but reading the help, I don't think it's going to do what you're looking to do.  You said you're trying to "COUNT" all rows in a worksheet that have "Y" in col A and "7036" in col E...

=SUM(IF('Meets Criteria - deduped'!A:A="Y",IF('Meets Criteria - deduped'!E:E=7036,1,0),0))

using CTRL+SHIFT+ENTER
0
 
LVL 2

Expert Comment

by:Hossy
ID: 33639247
Although, this seems to get the same answer:

=SUMPRODUCT(--('Meets Criteria - deduped'!E:E=7036),--('Meets Criteria - deduped'!A:A="Y"))
0
 
LVL 2

Expert Comment

by:Hossy
ID: 33639261
Sorry....using your ranges:

=SUMPRODUCT(--('Meets Criteria - deduped'!E2:E4000=7036),--('Meets Criteria - deduped'!A2:A4000="Y"))

My correction to what you had was the command before "Y" at the end.
0
 
LVL 2

Expert Comment

by:Hossy
ID: 33639266
sorry, COMMA, not command lol
0
 
LVL 2

Expert Comment

by:Hossy
ID: 33640900
Was there something wrong with my solution?  I believe I provided a solution that matched your requirements better.

1. You required the use of SUMPRODUCT.  The array*array format you selected is the old-style format (=SUM(array*array) with CSE) and SUMPRODUCT was created to replace this.  SUMPRODUCT format is =SUMPRODUCT(array,array).  Although it technically works, it is not the intended use of SUMPRODUCT.

2. My solution was the closest to match your code as your code only had a typo (comma should've been an equal sign).
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question