Hi guys and gals, I'm trying to calculate the average of a column if another column contains certain text, and of course, I need a macro to do this.
Here's what I've got so far:
Staff (no direct reports) 4
Staff (no direct reports) 5
Manager/Supervisor 4
Manager/Supervisor 3
Staff (no direct reports) 4
Staff (no direct reports) 5
Staff (no direct reports) 4
Staff (no direct reports) 4
Staff (no direct reports) 4
Staff (no direct reports) 4
Manager/Supervisor 5
Manager/Supervisor 4
Sub AverageManagers()
Dim AverageRange As Range
Set AverageRange = Range("E5", Range("E5").End(xlDown))
Dim Min As Range
Set Min = Range("D5")
Range("E2") = Application.WorksheetFunction.AverageIf(AverageRange, "Manager/Supervisor" & Min, AverageRange)
Range("D2").Select
End Sub
My VBA skills are limited to hunting and pecking at this point, so your help is appreciated!
Bookmarks