P
Paul Lautman
In a sheet with data as follows
A B
1 X 3
2 Y 4
3 X 5
I have the formula =SUMPRODUCT((A1:A3="X")*(B1:B3)*1) which returns 8.
So far so good.
But when I try to execute the following VB:
Debug.Print Application.WorksheetFunction.SumProduct((Range("A1:A3") =
"X"), Range("B1:B3"), 1)
I get Run-time error '13': Type mismatch.
So what did I do wrong?
A B
1 X 3
2 Y 4
3 X 5
I have the formula =SUMPRODUCT((A1:A3="X")*(B1:B3)*1) which returns 8.
So far so good.
But when I try to execute the following VB:
Debug.Print Application.WorksheetFunction.SumProduct((Range("A1:A3") =
"X"), Range("B1:B3"), 1)
I get Run-time error '13': Type mismatch.
So what did I do wrong?