View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
StumpedAgain StumpedAgain is offline
external usenet poster
 
Posts: 192
Default calculate percentage of cells that have any value

Try the following. Replace "A1" for where your values start. Hope this helps!


Option Explicit
Sub percentnumeric()

Dim cell As Range
Dim i, j As Long

i = 0
j = 0

For Each cell In Range(Range("A1"), Range("A1").End(xlDown))
If IsNumeric(cell) And cell < "" Then i = i + 1
j = j + 1
Next cell

MsgBox (i & "/" & j & " have numeric values. This is " & i / j * 100 & "%.")

End Sub
--
-SA


"JLeck" wrote:

I have a column of numbers, and I want to calculate how many rows have a
non-blank in them. Regardless of the value in the cells, I want to know what
percentage HAVE a (numeric) value. How do I do that? Thanks.