ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   function within a function #2 (https://www.excelbanter.com/excel-programming/291353-function-within-function-2-a.html)

Frankyboy

function within a function #2
 
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



Tom Ogilvy

function within a function #2
 
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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





Frankyboy

function within a function #2
 
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:B2 00=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?

"Tom Ogilvy" a écrit dans le message de
...
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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







Rob van Gelder[_4_]

function within a function #2
 
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)


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Frankyboy" wrote in message
. ..
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:B2 00=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?

"Tom Ogilvy" a écrit dans le message de
...
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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









Frank Kabel

function within a function #2
 
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


Frankyboy wrote:
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:B2 00=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?

"Tom Ogilvy" a écrit dans le message de
...
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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




Tom Ogilvy

function within a function #2
 
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.


--
Regards,
Tom Ogilvy

Frankyboy wrote in message
. ..
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:B2 00=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?

"Tom Ogilvy" a écrit dans le message de
...
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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









Tom Ogilvy

function within a function #2
 
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)

--
Regards,
Tom Ogilvy

Tom Ogilvy wrote in message
...
=sumproduct(--(A1:A200=X),--(B1:B200=Y),C1:C200)

--
Regards,
Tom Ogilvy

"Frankyboy" wrote in message
. ..
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








All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com