Has anyone successfully used the WorksheetFunction AVERAGEIFS?
I'm having real trouble figuring out the syntax for the function in VBA.
This doesn't work -
This does work -
So it's something to do with the string syntax of the criteria for the date range.
NB: Range("Resolved") is a list of Date/Times
Please help!
I'm having real trouble figuring out the syntax for the function in VBA.
Code:
strLowerDate = Format(dblRunDate + TimeSerial(0, 0, 1), "dd/mm/yyyy hh:mm:ss")
strUpperDate = Format(dblRunDate + TimeSerial(23, 59, 59), "dd/mm/yyyy hh:mm:ss")
This doesn't work -
Code:
dblResolved = Application.WorksheetFunction.AverageIfs(Range("Resolved"), _
Range("Language"), Language, _
Range("Resolved"), ">=" & strLowerDate, _
Range("Resolved"), "<=" & strUpperDate)
This does work -
Code:
dblResolved = Application.WorksheetFunction.AverageIfs(Range("Resolved"), _
Range("Language"), Language)
So it's something to do with the string syntax of the criteria for the date range.
NB: Range("Resolved") is a list of Date/Times
Please help!