greddin
asked on
Counting number of rows with number greater than 1
I have a column in my spreadsheet named "Revision". A sampling of this column data looks like this:
1
1
2
15
1
1
4
1
I need a total count of the rows where the number in it is greater than 1. Not a sum of the numbers but just a count of rows where the number is greater. So for the above sample my count would be: 3
Can anyone help with a function for this?
Thank you.
1
1
2
15
1
1
4
1
I need a total count of the rows where the number in it is greater than 1. Not a sum of the numbers but just a count of rows where the number is greater. So for the above sample my count would be: 3
Can anyone help with a function for this?
Thank you.
ASKER
No, I just want to count the rows which are greater than 1.
Assuming the data starts in A1 and there are 100 rows
Dim lngIndex As Long
Dim lngCount As Long
For lngIndex = 1 To 100
If Range("A" & lngIndex).Value > 1 Then
lngCount = lngCount + 1
End If
Next
MsgBox lngCount
Dim lngIndex As Long
Dim lngCount As Long
For lngIndex = 1 To 100
If Range("A" & lngIndex).Value > 1 Then
lngCount = lngCount + 1
End If
Next
MsgBox lngCount
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the answers guys. I'm accepting ged325's answer as best because it's very clean and efficient. I want to also award MartinLiss some points as well because his would work as well. Thanks again.
If so:
http://www.excelforum.com/excel-worksheet-functions/365877-count-distinct-values.html