sumproduct

  • Thread starter Thread starter jaypee
  • Start date Start date
J

jaypee

im using this formula:
=SUMPRODUCT((A2:A6="Male")*(B2:B6=21))

i want to change the rangeto A:A(all column A) and B:B but #NUM! always the
output.
what should i do?
 
SUMPRODUCT doesn't work with complete columns, you have to specify a range.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
You could get round the problem by using offset

=SUMPRODUCT((A2:OFFSET(A2,COUNTA(A:A)-1,0)="Male")*(B2:OFFSET(B2,COUNTA(A:A)-1,0)=21))
 
As long as there are no embedded blanks.

Better IMO aidan to defin dynamic ranges and use them, doesn't clog the
formula up.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Sometimes, if you include lots of unnecessary cells, the formulas will slow
down.

My rule of thumb is to guess how many rows I need, then double it (then add a
bit more). It's not perfekt, though.
 
or use dynamic ranges (which is perfekt, sometimes <vbg>)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
what do mean by dynamic range?
can you give example?
thanks
Bob Phillips said:
or use dynamic ranges (which is perfekt, sometimes <vbg>)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Aidan has already given an example

=SUMPRODUCT((A2:OFFSET(A2,COUNTA(A:A)-1,0)="Male")*(B2:OFFSET(B2,COUNTA(A:A)
-1,0)=21))

the OFFSET(A2,COUNTA(A:A)-1,0) part will ensure that the range looked at is
just as big as the data, as long as there are no blank rows embedded in the
data. He subtracts 1 because he is assuming the data starts in row 2, if row
3, subtract 2 etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

jaypee said:
what do mean by dynamic range?
can you give example?
thanks
 

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


Back
Top