Specify a range rather than a specific value with COUNTIF

  • Thread starter Thread starter guilbj2
  • Start date Start date
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
 
Hi
try something like
IF(AND(A1<upper_value,A1>lower_value),"A1 within range","A1 out of
range")
 
=SUMPRODUCT(--(A1:A100>=low_value),--(A1:A100<=high_value))
best wishes
Bernard
 
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
 
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))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top