sumif and array formulas

G

Guest

In the following formaula i am essentually summing a range if another range
in the same row = zero

=IF(SUM(CT2:CW2)=0,SUM(CW2:DH2),0)

My worksheet fill this down to row 300 and I total this at the the top,
however I am not really after the detail of each row but ratherjust the total
as I am going to roll the formula and the detail will add too many columns to
my sheet.

How do I modify the above as an array formula so that it inspect and total
for rows 2 to 300.

I have this but its does not work;

{=IF(SUM(CT2:CW300)=0,SUM(CW2:DH300),0)}

Bruce
 
G

Guest

Bruce
So close - try swapping the IF and the SUM:

{=SUM(IF(CT2:CW300)=0,SUM(CW2:DH300),0)}

cheers
Simon
 
G

Guest

Thanks Simon,

I assume that I need to adjust my bracketing as such

{=SUM(IF(CT2:CW300=0,SUM(CW2:DH300)),0)}

However the result it gives me is far greater than a simple sum(CW2:DH300)

Any ideas why?

Bruce
 
H

Harlan Grove

Bruce wrote...
In the following formaula i am essentually summing a range if another range
in the same row = zero

=IF(SUM(CT2:CW2)=0,SUM(CW2:DH2),0) ....
How do I modify the above as an array formula so that it inspect and total
for rows 2 to 300.
....

You want the row-wise sums of CT:CW and CW:DH. Use MMULT.

=SUMPRODUCT(--(MMULT(CT2:CW300,{1;1;1;1})=0),
MMULT(CW2:DH2,{1;1;1;1;1;1;1;1;1;1;1;1}))
 
G

Guest

Harlin,

Close to what Im after but not quite. To elaborate your interpretation;

I want the row-wise sum of CW2:CH300 if the corresponding row-wise sum of
CT2:CW2 = 0.

I know the correct number it should return but I cant get it to work from
these suggestions.

Bruce
 
H

Harlan Grove

Bruce wrote...
....

First, if you can't bother to spell names correctly, don't bother
including salutations.
I want the row-wise sum of CW2:CH300 if the corresponding row-wise sum of
CT2:CW2 = 0.

You showed CW2:DH300 before, not CH2:CW300. I'll assume the original
was correct. I screwed up my second range reference. Try

=SUMPRODUCT(--(MMULT(CT2:CW300,{1;1;1;1})=0),
MMULT(CW2:DH300,{1;1;1;1;1;1;1;1;1;1;1;1}))

If you actually do want to sum CH:CW, then use

=SUMPRODUCT(--(MMULT(CT2:CW300,{1;1;1;1})=0),
MMULT(CH2:CW300,{1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1}))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Using SUM + INDEX in array formula 5
SumIf AND 6
sumif formula 2
Sumif with an array for criteria 3
Sumif across a table 1
Sumif array? 1
Two search arguments in array formula 4
SUMIF and SUM.NUMBER 8

Top