Solved

Using Sumproduct to count all rows which meet two conditions

Posted on 2010-09-09
9
349 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

762 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

21 Experts available now in Live!

Get 1:1 Help Now