function within a function #2

  • Thread starter Thread starter Frankyboy
  • Start date Start date
F

Frankyboy

I need to combine 2 SUM-IF but Excel says that it is not possible

What I need to do is to get the sum of column C if the value of column A is
X and the value of column B is Y

Can someone help me with that?

Frank
 
this formula doesn't work for me. What do you mean by "--" in the formula?
I have tried all of those and nothing works:
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)
=sumproduct(sumproduct(A1:A200=X),sumproduct(B1:B200=Y),C1:C200)
=sumproduct((A1:A200=X),(B1:B200=Y),C1:C200)
=sumproduct(A1:A200=X,B1:B200=Y,C1:C200)

I don't see where I'm wrong?
 
The -- is a cool trick to turn a boolean into a number: TRUE = 1, FALSE = 0

If A1 equals X then
--(A1=X) = 1

If A1 doesn't equal X then
--(A1=X) = 0


Another way of turning a boolean into a number is: A1*1 (where A1 is TRUE
or FALSE)
 
Hi
is X a text value (thqats is the character 'X'). If yes, try
=sumproduct(--(A1:A200="X"),--(B1:B200="Y"),C1:C200)
or
=sumproduct((A1:A200="X")*(B1:B200="Y"),C1:C200)

Frank
 
Replacing X and Y with cell references

=SUMPRODUCT(--(A1:A200=E1),--(B1:B200=F1),C1:C200)

works fine

Replacing with constants

=SUMPRODUCT(--(A1:A200="A"),--(B1:B200=3),C1:C200)

works fine.

For X and Y to work as the formula was written, they would have to be
defined names. I was using the example information you gave.
 
Just to be completely clear:

If you meant column A literally contains the letter X and column B literally
contains the letter Y

=sumproduct(--(A1:A200="X"),--(B1:B200="Y"),C1:C200)
 
Back
Top