View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
compliance data compliance data is offline
external usenet poster
 
Posts: 9
Default biconditional countif function in Excel

Thank you Harlan I changed the direction of < and got the correct response.
Thanks to all of you who have contributed towards this solution!!


"Harlan Grove" wrote:

compliance data wrote...
Tried it this morning and it did not work. I was looking for values .5 and
<2.0. for this paericular data set there are 76 cells in the column. 3 cells
were =2.0 and 72 were <=.5. The answer should have been 1 got 69??


Show the exact formula you used. Was it

=COUNTIF(YourRangeHere,"<2")-COUNTIF(YourRangeHere,"<=.5")

?

Your result, 69, suspiciously equals 72 - 3, so it seems you may have
used

=COUNTIF(YourRangeHere,"<=.5")-COUNTIF(YourRangeHere,"=2")

Reread Chip's response.

"Chip Pearson" wrote:
Use two COUNTIFs.

=COUNTIF(A1:A10,"<=9")-COUNTIF(A1:A10,"<5")

This will return the count of numbers in A1:A10 that are between 5 and 9.
Change the "<" and "<=" comparison operators to fit your needs.

....

The order of the comparisons is essential. The first COUNTIF call needs
to count all items up to the TOP end of your range, and the second
COUNTIF call needs to count all items below the BOTTOM end of your
range. Since your range is 0.5 to 2.0 exclusive, the first COUNTIF
call's criterion should be <2, and the second one's criterion <=.5.

Another alternative might make it easier.

=COUNTIF(YourRangeHere,"<2")+COUNTIF(YourRangeHere ,".5")
-COUNT(YourRangeHere)