Any thoughts on this, how to make it work as a UDF using Application.WorksheetFunction.LinEst?
On the worksheet this formula functions correctly, returns a value.
Trying to wrap it in a VBA UDF, the VBA function is:
But, when i call this function on the worksheet with this formula, it returns #VALUE
On the worksheet this formula functions correctly, returns a value.
Excel Formula:
=INDEX(LINEST((K2:K11*L2:L11),(J2:J11*L2:L11),FALSE),1,1)
Trying to wrap it in a VBA UDF, the VBA function is:
VBA Code:
Function tst_linest(y As Range, x As Range, w As Range)
tst_linest = Application.WorksheetFunction.Index(Application.WorksheetFunction.LinEst((y * w), (x * w), False), 1, 1)
End Function
But, when i call this function on the worksheet with this formula, it returns #VALUE
Excel Formula:
=tst_linest(K2:K11,J2:J11,L2:L11,FALSE)