I work with the functions workheetfunction.averageifs () and workheetfunction.countifs ().
I have some conditions that determine which criteria to look for, so I would just like to have an array to which new criteria can be added, so instead of a number of cluttered conventions:
If (dep = 0) Then sortspg = True colcount = .CountIfs(column, "<3", badCol, "1") If (colcount > 0) Then colavg = .AverageIfs(column, column, "<3", badCol, "1") insert = True Else insert = False End If Else colcount = .CountIfs(column, "<3", DepColumn, dep, badCol, "1") If colcount > 0 Then colavg = .AverageIfs(column, column, "<3", DepColumn, dep, badCol, "1") insert = True Else insert = False End If End If
I could just pass an array like:
CondArray(column => "<3", DepColumn => dep) If colCount > 0 Then CondArray[] = (badCol => "1")
and then
.CountIfs(CondArray) .AverageIfs(column, CondArray)
source share