Countif Function

B

Bill

Hello,
I am missing something simple here I think. I have some data in column
A. I would like to count the data based on criteria; either above some
value, below some value or between two values. I started with the
simple above some value and used the following code:

Sub test()
Dim Minv, Maxv
Application.Goto reference:="aaa"
Minv = 0
MsgBox Application.CountIf(Selection, " > & Minv & ")
End Sub

aaa is the named reference containing the data and is OK. All but one
entry is above 0, but the above codes give him 0 for the countif.

What am I doing wrong? Thanks

Bill


*** Sent via Developersdex http://www.developersdex.com ***
 
J

Jim Thomlinson

You have an issue with " > & Minv & "

Try this...
MsgBox Application.CountIf(Selection, "> " & Minv )
 
J

Joerg

Sub test()
Dim Minv, Maxv
Application.Goto reference:="aaa"
Minv = 0
MsgBox Application.CountIf(Selection, ">" & Minv)
End Sub


cheers

Joerg
 

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

Top