PDA

View Full Version : Solved: Find the rows count in in a column where cell value >0



darweesh8
02-16-2012, 05:34 AM
Experts,

I need a code to find the rows count in in a column where cell value >0

example: if column likbelow
20
15
10
5
4
1
0
0
0


then the row count is 9 but i need it to be 6 (zero to not counted as used cell)

Please help. :dunno :dunno

p45cal
02-16-2012, 05:46 AM
try:
=COUNTIF(A2:A6,">0")

Jacob Hilderbrand
02-16-2012, 08:35 AM
x = Application.WorksheetFunction.CountIf(Range("A:A"), ">0")

Or

x = Evaluate("=COUNTIF(A:A," & """" & ">0" & """" & ")")

For the evaluate to work the sheet you are analyzing must be active. For the WorksheetFunction you can put the sheet name before the range if the sheet is not the active sheet.

Thanks

Jake

darweesh8
02-19-2012, 02:08 AM
DRJ,

A million thanks, that was great.:bow:

How can I mark this issue as solved? :think:

Bob Phillips
02-19-2012, 07:13 AM
At the head of the threads there is a 'Thread Tools' dropdown, the solved option is in there.

I worked in Jordan a fair bit last year, are you living in Amman.