countif

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

I want to count the the number cells in a column that
contain a percentage between 25% and 30%. I can't find
a "between" function for the formula.
 
Hi Tim

We are 8 men here that's older than 50 years and 6 men here older than 60 years. So how
many is between 50 and 60 ?

.... Count all > 25% and from that subtract all > 30 %.
 
=COUNTIF(Range,">=25%")-COUNTIF(Range,">30%")

assuming you want to include 25 and 30%
 
=COUNTBETWEEN(Range,25%,35%) where COUNTBETWEEN is:

Function COUNTBETWEEN(rng, valLow, valHigh, _
Optional inclLow As Boolean = True, _
Optional inclHigh As Boolean = True)
Select Case inclLow & inclHigh
Case "TrueTrue"
COUNTBETWEEN = Application.CountIf(rng, ">=" & valLow) _
- Application.CountIf(rng, ">" & valHigh)
Case "FalseFalse"
COUNTBETWEEN = Application.CountIf(rng, ">" & valLow) _
- Application.CountIf(rng, ">=" & valHigh)
Case "FalseTrue"
COUNTBETWEEN = Application.CountIf(rng, ">" & valLow) _
- Application.CountIf(rng, ">" & valHigh)
Case "TrueFalse"
COUNTBETWEEN = Application.CountIf(rng, ">=" & valLow) _
- Application.CountIf(rng, ">=" & valHigh)
End Select
End Function

Alan Beban
 
Back
Top