Go Premium for a chance to win a PS4. Enter to Win

x
Solved

# I need an excel formula corrected

Posted on 2011-03-07
Medium Priority
340 Views
When I am trying to use the following formula, I get (0) returned and I know there should be a large number:

=SUMPRODUCT(((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)*(((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1))>0)*(Mansfield!\$J\$2:\$J\$10000)*(Mansfield!\$K\$2:\$K\$10000="N")

If I use this one, I get an anwser:

=SUMPRODUCT((Mansfield!\$C\$2:\$C\$10000=DATA!A5)*(((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)*(((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1))>0)*(Mansfield!\$J\$2:\$J\$10000)*(Mansfield!\$K\$2:\$K\$10000="N"))

The only difference is ((Mansfield!\$C\$2:\$C\$10000=DATA!A5), which is a column and reference for a persons name. I am wanting the total for the values and am not looking for a specific name. Do I have some parenthesis out of whack?
0
Question by:wrt1mea

LVL 59

Accepted Solution

Saurabh Singh Teotia earned 1000 total points
ID: 35061796

This should work...

=SUMPRODUCT((((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)*(((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1))>0)*(Mansfield!\$J\$2:\$J\$10000)*(Mansfield!\$K\$2:\$K\$10000="N"))

If this is not working can you post worksheet...

Saurabh...
0

LVL 85

Assisted Solution

Rory Archibald earned 1000 total points
ID: 35061799
Yes:

=SUMPRODUCT((((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)*(((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1))>0)*(Mansfield!\$J\$2:\$J\$10000)*(Mansfield!\$K\$2:\$K\$10000="N"))
0

LVL 1

Author Closing Comment

ID: 35062107
Both worked! Anyone care to explain what i did wrong?
0

LVL 50

Expert Comment

ID: 35062141
I think the parentheses were out as you suggested - in fact you can get rid of some more - this should work

=SUMPRODUCT(((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1)>0)*((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1)>0)*(Mansfield!\$K\$2:\$K\$10000="N"),Mansfield!\$J\$2:\$J\$10000)

regards, barry
0

LVL 1

Author Comment

ID: 35062493
For some reason I always thought that if you opened the formula with 3 parentheses, you had to close it with that number too...
0

LVL 50

Expert Comment

ID: 35063177
Well, you obviously have to match the parentheses, for every one you open you must close one....but you can still do that correctly and get the formula wrong......

...in this formula (your first one)

=SUMPRODUCT(((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)*(((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1))>0)*(Mansfield!\$J\$2:\$J\$10000)*(Mansfield!\$K\$2:\$K\$10000="N")

.....you are missing a parenthesis at the start so in fact the SUMPRODUCT ends too early.......it's only this part

=SUMPRODUCT(((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1))>0)

because by that point you have closed as many parentheses as you have opened, so SUMPRODUCT is finished....and in the above there is no "co-ercer" [you aren't multiplying by anything or using *1 etc,] so it will always give a result of zero....then the rest of the formula will be irrelevant because whatever it is, you are multiplying by zero...so the result is going to be zero. Perhaps simpler to write like this

=SUMPRODUCT(
((Mansfield!\$H\$2:\$H\$10000>\$P\$1)+(Mansfield!\$I\$2:\$I\$10000>=\$P\$1)>0)+0,
((Mansfield!\$H\$2:\$H\$10000<=\$Q\$1)+(Mansfield!\$I\$2:\$I\$10000<=\$Q\$1)>0)+0,
(Mansfield!\$K\$2:\$K\$10000="N")+0,
Mansfield!\$J\$2:\$J\$10000
)

The function name and the opening bracket is on line 1 and the last line is just the closing bracket. Lines 2 , 3 and 4 are individula conditions and in each of those the brackets must match, line 5 is the sum range which doesn't need any.....

regards, barry

0

## Featured Post

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabilâ€¦
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
###### Suggested Courses
Course of the Month10 days, 13 hours left to enroll