title: function for average of visible data on filtered table
body: <pre class="lang-vb prettyprint-override"><code>FUNCTION_TABLE_ARRAY_AVERAGE(Rg As Range)
  'Trying to get average of filtered cells
      Dim xCell As Range
      Dim xCount As integer
      Dim xTtl As variant
      Application.Volatile
      Set Rg = Intersect(Rg.Parent.UsedRange, Rg)
      For Each xCell In Rg
          If xCell.ColumnWidth &gt; 0 _
            And xCell.RowHeight &gt; 0 _
            And Not IsEmpty(xCell) _
            And IsNumeric(xCell.Value) Then
                xTtl = xTtl + xCell.Value
                xCount = xCount + 1
          End If
      Next
      If xCount &gt; 0 Then
          AverVisible = xTtl / xCount
      Else
          AverVisible = 0
      End If
  End Function
  </code></pre>
  <p>I'm looking to have this function calculate the average of a fraction or decimal or whole number in the
  column i select on a filtered table.</p>