Solved

Using Sumproduct to count all rows which meet two conditions

Posted on 2010-09-09
9
350 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now