I want to use averageifs in one of my calculations that references one of the columns of a table called Table1 in one of the worksheets. I can do it if I paste the formula in the cells. But I have a lot of cells so I want to avoid pasting. In short I want to say:
Selection.Value = WorkSheetfunction.AverageIff(Table1["Col A"], . . . .
Where Col A is the column that contains that data values
Currently this works:
With Selection
.FormatConditions.Add Type:=xlExpression, Formula1:=formula
where
formula = "=AVERAGEIFS(Table1[" + name + "],Table1[CELLNAME],Template!RC1,Table1[Date],Template!R1C)"
But as I said, I want to make the code more efficient and avoid pasting the formula. So how to insert a table column as a criteria into a worksheet function.
Thanks