Hi
I am trying to build my first custom function. It returns a value error. I thought the error might be the type of data for my arguments. I tried range, long variant but still value error.
I am trying to build my first custom function. It returns a value error. I thought the error might be the type of data for my arguments. I tried range, long variant but still value error.
Code:
Function weightedaverage(array1 As Range, array2 As Range, array3 As Range) as long
Dim client As Long
Dim panel As Long
client = Application.WorksheetFunction.SumProduct(array1, array3)
panel = Application.WorksheetFunction.SumProduct(array2, array3)
weightedaverage = Round((client / panel - 1) * 100, 2)
End Function