Countif for numbers between x and y

D

don

If I have a column of numbers from -100 to + 100 how can I count the
number of rows containing numbers between 40 and 50.
=COUNTIF(J$4:J$1058,AND("<50,>40"))

Doesn't work. I get zero.

Thanks
Don
 
D

don

thanks Peo,
Can you expand this so the >40 portion is in a cell and can be
easily changed?
I tried a couple of versions and referring to a cell didn't seem to
work.

Thanks
Don
 
R

Ragdyer

Try this, with > value in J1, and < value in J2:

=SUMPRODUCT((J4:J1058>J1)*(J4:J1058<J2))
 
B

bj

also you can try
=countif(J$4:J$1058,"<=50")-countif(J$4:J$1058,"<40")
play with the less than/less than or equals as needed.
 
Top