Your function will take Pi to be a variable, equal to 0 as it is not defined. Therefore number*pi*0.05 will be equal to 0, sin(0) = 0, therefore x1 = x1*0 = 0 and MM = -2*0/x3 = 0. Try
Function MM(ByVal number As Double)
x1 = 1
For i = 1 To 6
x1 = x1 * Sin(number * worksheetfunction.Pi() * 0.05)
Next i
x2 = Power((number - 10) / 80, 2)
x3 = Power(2, 2 * x2)
MM = -2 * (x1 / x3)
End Function
Note, the power function doesn't work for me but that could be a version thing, I would use
x2 = ((number-10)/80)^2
x3 = 2^(2*x2)
instead
Bookmarks