A B
1 10 20
2 10 0
3 10 -5
4 10 15
5 10 0
Alright say you have this as your data field. I know that using the SUMIF
function will give me the total of A if B > 0 (or whatever I set the criteria
to), BUT how can I get the sum of A AND B if B is greater than 0
Dave Peterson - 16 Sep 2007 20:53 GMT
I'd use something like:
=SUMIF(B:B,">"&0,A:A)+SUMIF(B:B,">"&0)
or
=SUMIF(B:B,">"&0,A:A)+SUMIF(B:B,">"&0,B:B)
> A B
> 1 10 20
[quoted text clipped - 6 lines]
> function will give me the total of A if B > 0 (or whatever I set the criteria
> to), BUT how can I get the sum of A AND B if B is greater than 0

Signature
Dave Peterson
Ragdyer - 16 Sep 2007 23:31 GMT
Try this:
=SUMPRODUCT((B1:B5>0)*((B1:B5)+(A1:A5)))

Signature
HTH,
RD
---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
> A B
> 1 10 20
[quoted text clipped - 6 lines]
> function will give me the total of A if B > 0 (or whatever I set the criteria
> to), BUT how can I get the sum of A AND B if B is greater than 0
Teethless mama - 17 Sep 2007 01:50 GMT
Slightly shorter, and more elegant
=SUMPRODUCT((B1:B5>0)*A1:B5)
> Try this:
>
[quoted text clipped - 11 lines]
> criteria
> > to), BUT how can I get the sum of A AND B if B is greater than 0
Ragdyer - 17 Sep 2007 02:51 GMT
Yes ... more elegant!<bg>

Signature
Regards,
RD
---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
> Slightly shorter, and more elegant
>
[quoted text clipped - 19 lines]
> > criteria
> > > to), BUT how can I get the sum of A AND B if B is greater than 0