Newbe Help with count/countif function

  • Thread starter Thread starter Cybertech
  • Start date Start date
C

Cybertech

:confused: I'm trying to count the number of rows that fall within a
numerical range. For example I want to count the number of rows that
contain a value >5 and <=10

I tried both count and countif and keep getting errors. Half if it is
no problem, =COUNTIF(E:E,">5") works as does =COUNTIF(E:E,"<=10") but
when I put them together I have problems.

I book uses the example {=SUM((E:E>5)*(E:E<=10))} but that doesn't work
either.

Can someone point me in the correct location?

Thanks!
 
Two options:

=COUNTIF(E:E,"<=10")-COUNTIF(E:E,"<6")

or

=SUMPRODUCT(--(E1:E1000<=10),--(E1:E1000>5))

Note you can't use an entirecolumn reference in Sumproduct hence the E1000.

Regards
Rowan
 
Thanks Bernie & Rowan!

I had found the answer a few minutes ago after searching the forums fo
the last hour and am using:

=COUNTIF(E:E,">5")-COUNTIF(E:E,">10") which works! I had been using AN
before and learned you can't with COUNTIF.

I also expanded on Rowan's second suggestion and am using:

=SUMPRODUCT((B2:B1322=9)*(E2:E1322>5)*(E2:E1322<=10))

in another area. I couldn't get it to work with the "--" part (and I'
not sure what it does) but when I removed it everything is workin
correctly.

Thanks Agai
 
Hi,

You may try another solution. This is an array formula (Ctrl+Shift+Enter)

SUM(IF((range>5)*(range<10),1,0))

Regards,
 
You're welcome.

The -- (double unary minuses) work in much the same way as the * in your
formula. They each cause the sumproduct to resolve True and False answers
into 1's and 0's. It comes down do a matter of preference which you use so
your formula could be:

=SUMPRODUCT(--(B2:B1322=9),--(E2:E1322>5),--(E2:E1322<=10))

More info on sumproduct at http://www.xldynamic.com/source/xld.SUMPRODUCT.html

Regards
Rowan
 

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

Back
Top