ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   countif in a value range? (https://www.excelbanter.com/excel-discussion-misc-queries/171005-countif-value-range.html)

pokdbz

countif in a value range?
 
I would like to do a count if a value is within a range like
=COUNTIF(E3:E150,"<=89 and =80")

But that doesn't work

Rick Rothstein \(MVP - VB\)

countif in a value range?
 
You have to do it in two parts... count the values less than or equal to
your maximum value and subtract the count of the values **less than**
(hence, no equal sign) than your minimum value...

=COUNTIF(E3:E150,"<=89")-COUNTIF(E3:E150,"<80")

Rick


"pokdbz" wrote in message
...
I would like to do a count if a value is within a range like
=COUNTIF(E3:E150,"<=89 and =80")

But that doesn't work



Ron Coderre

countif in a value range?
 
Try one of these:

=SUM(COUNTIF(E3:E150,{"<=89","<80"})*{1,-1})
or
=SUMPRODUCT((E3:E150=80)*(E3:E150<=89))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"pokdbz" wrote in message
...
I would like to do a count if a value is within a range like
=COUNTIF(E3:E150,"<=89 and =80")

But that doesn't work




T. Valko

countif in a value range?
 
Just to be different:

=INDEX(FREQUENCY(E3:E150,{89,79}),)

--
Biff
Microsoft Excel MVP


"pokdbz" wrote in message
...
I would like to do a count if a value is within a range like
=COUNTIF(E3:E150,"<=89 and =80")

But that doesn't work




Ron Coderre

countif in a value range?
 
I considered that approach....but...
If decimals can be in the list, it needs tweaking.
Values between 79 and 80, exclusive, trip it up.
(eg 79.5)

Perhaps:
=INDEX(FREQUENCY(E3:E150,{89,79.9999999999999}),)

--------------------------
Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"T. Valko" wrote in message
...
Just to be different:

=INDEX(FREQUENCY(E3:E150,{89,79}),)

--
Biff
Microsoft Excel MVP


"pokdbz" wrote in message
...
I would like to do a count if a value is within a range like
=COUNTIF(E3:E150,"<=89 and =80")

But that doesn't work







All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com