Specify a range rather than a specific value with COUNTIF

G

guilbj2

Is there a syntax that will allow me to use countif to check if a valu
falls within a range (between 1 and 10 for instance) rather than t
check if it's a specific value
 
F

Frank Kabel

Hi
try something like
IF(AND(A1<upper_value,A1>lower_value),"A1 within range","A1 out of
range")
 
B

Bernard V Liengme

=SUMPRODUCT(--(A1:A100>=low_value),--(A1:A100<=high_value))
best wishes
Bernard
 
T

Trev

Try something like this. It assumes that cell to be checked
is A1 cells(1,1). It just worked for me

Sub test()
Select Case Cells(1, 1)
Case 1 To 10
MsgBox "OK"
Case Else
MsgBox "Invalid"
End Select

End Sub

Trev
 
J

jeff

Or Try:

to include numbers 2 - 9
=SUMPRODUCT(--(A1:A10>1),--(A1:A10<10))
or to include 1's and 10's
=SUMPRODUCT(--(A1:A10>=1),--(A1:A10=<10))
 
Top