Solved

Counting number of rows with number greater than 1

Posted on 2012-03-22
6
313 Views
Last Modified: 2012-03-22
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.
0
Comment
Question by:greddin
  • 2
  • 2
  • 2
6 Comments
 
LVL 39

Expert Comment

by:Kyle Abrahams
ID: 37754731
0
 

Author Comment

by:greddin
ID: 37754738
No, I just want to count the rows which are greater than 1.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 37754757
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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
ID: 37754781
Or better (no need to know how many rows).


Dim lngIndex As Long
Dim lngCount As Long
Dim r As Range

Set r = Range("A1").End(xlDown).Offset(0, 0)

For lngIndex = 1 To r.Row
    If Range("A" & lngIndex).Value > 1 Then
        lngCount = lngCount + 1
    End If
Next
MsgBox lngCount
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 400 total points
ID: 37754804
Adjust your range as needed.
=COUNTIF(A2:A30,">1")
0
 

Author Closing Comment

by:greddin
ID: 37755256
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.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now