Thread: Sum if and
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff Biff is offline
external usenet poster
 
Posts: 1,688
Default Sum if and

Try this:

=SUMPRODUCT(--(A2:A6<0),--(B2:B6<0),--((A2:A6=1000)+(B2:B6=1000)0),A2:A6)

Biff

"tomjoe" wrote in message
...
Sorry for the confusion. With "null" I mean the digit 0.
I see that I have a fault in my example, the right one is:

A B
1 1250
2 50 1500
3 0 1000
4 450 900
5 1200 850
6 1400 0


The sum is 50 + 1200 = 1250 in A1.
Only A2 and A5 meets the criteria of beeing =1000 in A OR B (not AND B)
AND
both cells must be different from 0.
Also this is only a part of a big excel workbook and I have minor
possibility to have the results in a column of it'sown, so I would prefer
very much to have the the result in A1.

Any suggestions ?


tomjoe



Biff skrev:

the formulas posted will only work until you have values of 1000 or
greater
in both columns A & B. Once this occurrs, the formulas will sum both
columns
A & B


Good catch. Try this:

=SUMPRODUCT(--((A2:A6=1000)+(B2:B6=1000)0),--(B2:B6<""),A2:A6)

I'm not sure what they meant about the "null". EMPTY or BLANK cells in
just
column B or BOTH columns. Based on their description and expected result
they did not mean null = number 0.

Biff

"watchtower" wrote in message
...
the formulas posted will only work until you have values of 1000 or
greater
in both columns A & B. Once this occurrs, the formulas will sum both
columns
A & B. From what you wrote, it didn't seem like that was what you
wanted.

Still working on fitting it into one formula... create another column,
in
this case C:C, but could be anywhere
=IF(B2=1000,A2,IF(A2=0,"",IF(A2=1000,A2,""))) copy down for all your
data
and then just sum the column.


"Biff" wrote:

Try this:

column B is =1000 AND no cells must have the value null.

What does "null" mean? Do you mean EMPTY or BLANK cells?

=SUMPRODUCT(--((A2:A6=1000)+(B2:B6=1000)),--(B2:B6<""),A2:A6)

Biff

"tomjoe" wrote in message
...
I am new in here. Could someone give me a tip on how to manage
this:
I have numbers in two columns (Aerea A2:B22).
In A1 I want to sum up the values in A2:A22 where the cell in column
A
is
=1000 OR the corresponding cell in column B is =1000 AND no cells
must
have
the value null. In the small sample under the cells in A2 + A5 + A6
meets
the
criteria and the sum in A1 is then 2650.

A B
1 2650
2 50 1500
3 0 1000
4 450 900
5 1200 850
6 1400 0

Someone have any clue ? SUMIF, SUMPRODUCT or nested if ?