Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# Using Sumproduct to count all rows which meet two conditions

Posted on 2010-09-09
Medium Priority
368 Views
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
Question by:shamrin
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions

LVL 45

Accepted Solution

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

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

LVL 45

Expert Comment

ID: 33638978
Oops, should have been:

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

LVL 93

Expert Comment

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

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

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

ID: 33639261

=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

ID: 33639266
sorry, COMMA, not command lol
0

LVL 2

Expert Comment

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

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â€¦
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 create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a â€¦
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
###### Suggested Courses
Course of the Month9 days, 11 hours left to enroll

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

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