I´m pretty new at this so I ´ve been having some trouble with this code and was hoping to get some help. The goal is to average a range of filtered/visible cells when it meets the criteria of another range2 (which is text).
I have the following so far:
Function AverVisibleIC(Rg As Range, BU As Range)
Dim xCell As Range
Dim xCount As Integer
Dim xTtl As Double
Dim c As Range
Set BU = Range("B13:B44")
Application.Volatile
Set Rg = Intersect(Rg.Parent.UsedRange, Rg)
For Each xCell In Rg
If xCell.ColumnWidth > 0 _
And xCell.RowHeight > 0 _
And Not IsEmpty(xCell) _
And IsNumeric(xCell.Value) Then
xTtl = xTtl + xCell.Value
xCount = xCount + 1
End If
Next
If xCount > 0 Then
For Each c In BU
If c.Value = "IC" Then
AverVisibleIC = xTtl / xCount
Else
AverVisibleIC = 0
End If
End If
Next
End Function
Thanks!