EXCEL COUNTIF problem

A

andyp161

I want to count the number of cells that contain numbers greater than
1930 and less that 1940. The following does not seem to work:
=COUNTIF($C$2:$C$2502,">1930","<1940"). Any suggestions??

Kind regards
 
N

Norman Harker

Hi Andyp161!

One approach:

=COUNTIF(A1:A29,">1930")-COUNTIF(A1:A29,">=1940")

Another:

=SUMPRODUCT(--(A1:A29>1930),--(A1:A29<1940))

The -- coerces Boolean returns of TRUE and FALSE from the bracketted
expressions into 1 and 0.
 
A

Andy B

Hi

You can either use 2 COUNTIFs:
=COUNTIF($C$2:$C$2502,">1930")-COUNTIF($C$2:$C$2502,">1940")
or you could try:
=SUMPRODUCT(($C$2:$C$2502 >1930)*($C$2:$C$2502 <1940)*($C$2:$C$2502))
 
A

Andy B

Hold on!! My second formula sums the figures!. Try this:
=SUMPRODUCT(($C$2:$C$2502 >1930)*($C$2:$C$2502 <1940))

--
Andy.


Andy B said:
Hi

You can either use 2 COUNTIFs:
=COUNTIF($C$2:$C$2502,">1930")-COUNTIF($C$2:$C$2502,">1940")
or you could try:
=SUMPRODUCT(($C$2:$C$2502 >1930)*($C$2:$C$2502 <1940)*($C$2:$C$2502))
 

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

Top