I have a public function (to find the PDF of an Exponential in this case) and if the X value is outside the area of the curve I want to send back a value of 0 then have the function end.
I am getting a Value# error instead.
HELP!!! and thanks
Public Function CurveEXPPDF(A, DefineCurve As Range)
' The Probability Density Function of a Exponential
'Put in the values for the specific curve
Shift = DefineCurve(1)
Maximum = DefineCurve(3)
Theta = DefineCurve(4)
'Determine if the curve is outside the allowed parameters (Less than the shift or greater than the Maximum)
If A < Shift Then CurveEXPPDF = 0: End <-- If a number lower than the 'shift' is selected I want to return a value of zero
If A > Maximum Then CurveEXPPDF = 0: End
' Get how far into the actual curve the X value is (adjusting for the shift)
X = A - DefineCurve(1)
CurveEXPPDF = Exp(-X / Theta) / Theta
End Function
I am getting a Value# error instead.
HELP!!! and thanks
Public Function CurveEXPPDF(A, DefineCurve As Range)
' The Probability Density Function of a Exponential
'Put in the values for the specific curve
Shift = DefineCurve(1)
Maximum = DefineCurve(3)
Theta = DefineCurve(4)
'Determine if the curve is outside the allowed parameters (Less than the shift or greater than the Maximum)
If A < Shift Then CurveEXPPDF = 0: End <-- If a number lower than the 'shift' is selected I want to return a value of zero
If A > Maximum Then CurveEXPPDF = 0: End
' Get how far into the actual curve the X value is (adjusting for the shift)
X = A - DefineCurve(1)
CurveEXPPDF = Exp(-X / Theta) / Theta
End Function