Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

SumProduct to count rows

Posted on 2011-03-14
Medium Priority
364 Views
In the attached file I am trying to count the number of rows in my sumproduct formula but it doesn't seem to be working correctly. If you look in cell E6 you can see the formula with the criteria's but when you verify the correct count it's a lot larger than what the formula is saying. Anyone know what is wrong with my formula?
Sample-File.xls
0
Question by:Lawrence Salvucci
[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
• 3
• 2

LVL 39

Accepted Solution

nutsch earned 2000 total points
ID: 35130808
Why do you divide by the countif?

=SUMPRODUCT((Database!\$E\$2:\$E\$7559>=\$B6)*(Database!\$E\$2:\$E\$7559<=\$D6)*(Database!\$D\$2:\$D\$7559>=66)*(Database!\$B\$2:\$B\$7559<\$A\$6))

works and matches your data, but then you divide by COUNTIF(Database!\$A\$2:\$A\$7559,Database!\$A\$2:\$A\$7559&"")

Can you restate your needs if the first formula doesn't address them?

Thanks,

Thomas

0

LVL 1

Author Comment

ID: 35130841
I thought I needed a countif to count the criteria. So a sumproduct counts the number of rows returned with you use the * between criterias?
0

LVL 39

Expert Comment

ID: 35130874
It counts when you don't multiply it by a range of values. Right now, you have =sumproduct(test*test*test*test), each test returns an array of 1s and 0s. When all test conditions are met, you get a line of 1s which multiplied together return 1. If one or more tests aren't met, you get 0, sumproduct then totals all the ones, which gives you the count of rows.

Thomas
0

LVL 1

Author Closing Comment

ID: 35131020
Thank you for the help!
0

LVL 39

Expert Comment

ID: 35131048

Thomas
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…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses
Course of the Month6 days, 1 hour left to enroll