Hi,
I am unable to get the following polynomial to work in VBA. I suspect it is because I am using ^ rather than EXP(), but I am not certain. I get the correct result when 'val = 0-20', but not when 'Val = 20.2 - 40' The code is:
Can anyone tell me where I am going wrong?
Thanks!
Oli
I am unable to get the following polynomial to work in VBA. I suspect it is because I am using ^ rather than EXP(), but I am not certain. I get the correct result when 'val = 0-20', but not when 'Val = 20.2 - 40' The code is:
Code:
Private Function AgeTransform(Val As Double) As Double
'this works fine
If Val >= 0 And Val <= 20 Then
AgeTransform = 0.000000000000322 + 23.954 * Val
'this is causing the problem
ElseIf Val >= 20.1 And Val <= 40 Then
AgeTransform = -811.473175258781 + 0.16396934404152 * Val ^ 1 + -5.61856987399637E-06 * Val ^2
Else: Exit Function
End If
End Function
Thanks!
Oli