beedistinct
Board Regular
- Joined
- Jun 24, 2011
- Messages
- 62
I wish to filter my data using the macro and then apply the AverageIfs function only on the filtered data. I've no idea how to restrict the AverageIfs function just to the data that is filtered.
The below is what I have so far. However, The AverageRange is the entire Range and not the filtered rows only.
The below is what I have so far. However, The AverageRange is the entire Range and not the filtered rows only.
Code:
Dim AverageCount As Long
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$C$14").AutoFilter Field:=2, Criteria1:="Active"
Set AverageRange = Range("A1:A13")
Set CriteriaRange = Range("C1:C13")
AverageCount = Application.AverageIfs(AverageRange, CriteriaRange, "<=1/11/2013")
MsgBox ("Average of Active cells is : " & AverageCount)