Hi I'm trying to come up with a way to represent a formula like:
=SUM(SUMIF(A2:A10,{"a";"b"},B2:B10))
into a dynamic vba statement.
i have an array built programmaticaly through vba with a list of names for different facilities, and i want to sum the number of hours they work. So in the above it be like looking in the range A2:A10 for any of the values in my array ({"a";"b"}) and summing up their hours which are in B2:B10.
I've tried stuff like
but that just gives me a #VALUE! error.
Any help would be much appreciated!
=SUM(SUMIF(A2:A10,{"a";"b"},B2:B10))
into a dynamic vba statement.
i have an array built programmaticaly through vba with a list of names for different facilities, and i want to sum the number of hours they work. So in the above it be like looking in the range A2:A10 for any of the values in my array ({"a";"b"}) and summing up their hours which are in B2:B10.
I've tried stuff like
Code:
Sheets("Sheet1").Cells(1,1).value = Evaluate("=sum(sumif(Sheet2!C:C," & array & ",Sheet2!D:D)")
but that just gives me a #VALUE! error.
Any help would be much appreciated!