Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 122
Default how to count if a cell value falls between two numbers

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
--
Glenn
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default how to count if a cell value falls between two numbers

Try

=SUMPRODUCT(--(B1:B535),--(B1:B5<40))

Hope this helps,

Hutch

"Glenn" wrote:

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
--
Glenn

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default how to count if a cell value falls between two numbers

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

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

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Glenn" wrote:

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
--
Glenn

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default how to count if a cell value falls between two numbers

Hi,

=countif(A1:A5,"35")-countif(A1:A5,"<40")

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Glenn" wrote in message
...
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
--
Glenn


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default how to count if a cell value falls between two numbers

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
---------------
Jacob Skaria


"Ashish Mathur" wrote:

Hi,

=countif(A1:A5,"35")-countif(A1:A5,"<40")

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Glenn" wrote in message
...
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
--
Glenn


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNT IF A VALUE FALLS WITHIN A RANGE IN A SINGLE CELL roland Excel Discussion (Misc queries) 2 August 5th 08 12:05 AM
displaying text in a cell if a another cell falls in a range THIRDCOAST Excel Worksheet Functions 2 February 1st 08 07:24 PM
count no. of dates in a column that falls on certain month & year RawSugar Excel Worksheet Functions 2 October 20th 05 10:50 PM
how to count if the value falls between a date range joe Excel Discussion (Misc queries) 3 September 28th 05 04:37 AM
get a count of numbers whose value falls within a given range LyleB_Austin Excel Worksheet Functions 5 August 3rd 05 04:38 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"