?
Solved

Using Sumproduct to count all rows which meet two conditions

Posted on 2010-09-09
9
Medium Priority
?
371 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 500 total points
ID: 33638969
Try,

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

Expert Comment

by:Tracy
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 93

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

850 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