how to count if a cell value falls between two numbers

G

Glenn

I tried to write a formula to count how often the value of a range of cells
falls between two numbers. for example in the chart below:

row value
1 25
2 27
3 36
4 37
5 42

I tried the formula =countif(a1:a5,and(>35,<40)) and my result was "0" when
it should be "2".

Can anyone help correct my formula?

thanks

glenn
 
R

ryguy7272

There are a few ways to to this:
=SUMPRODUCT((A1:A5>35)*(A1:A5<40))

=COUNTIF(A1:A5,">35")-COUNTIF(A1:A5,">40")

HTH,
Ryan---
 
J

Jacob Skaria

Ashish, you meant to say >40...

Ryan, since the condition is <40 you need to have the second condition as >=40

=COUNTIF(A1:A5,">35")-COUNTIF(A1:A5,">=40")

Glenn, if you are using Excel 2007 you can try the below

=COUNTIFS(A1:A5,">35",A1:A5,"<40")

If this post helps click Yes
 

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