ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Countif Function (https://www.excelbanter.com/excel-programming/372837-countif-function.html)

Bill[_39_]

Countif Function
 

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 ***

Jim Thomlinson

Countif Function
 
You have an issue with " & Minv & "

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

--
HTH...

Jim Thomlinson


"Bill" wrote:


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 ***


Joerg

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


cheers

Joerg



"Bill" wrote in message
...

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 ***





All times are GMT +1. The time now is 04:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com