Link to home
Start Free TrialLog in
Avatar of greddin
greddinFlag for United States of America

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.
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Avatar of greddin

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
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greddin

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.