WindsorKnot
Board Regular
- Joined
- Jan 4, 2009
- Messages
- 160
Hi, Im having trouble with my nested select case structure. I keep on getting the #NAME? Error
I have a table of values which are determined based on the class, then age. For example, if the class and age is 1 and 41 then the value to be returned should be 0.428
Below is my code. Any Feedback on where I'm going wrong would be helpful. Thanks!
I have a table of values which are determined based on the class, then age. For example, if the class and age is 1 and 41 then the value to be returned should be 0.428
Below is my code. Any Feedback on where I'm going wrong would be helpful. Thanks!
Code:
Function LTDVALUES(CLASS, AGE As Currency)
' Determine the class then determine the rate based on age
Select Case CLASS
Case 1: Select Case AGE
Case Is < 35: LTDVALUES = 0.331
Case 35 To 44: LTDVALUES = 0.428
Case 45 To 54: LTDVALUES = 0.58
Case Is > 55: LTDVALUES = 0.63
End Select
Case 2: Select Case AGE
Case Is < 35: LTDVALUES = 0.39
Case 35 To 44: LTDVALUES = 0.59
Case 45 To 54: LTDVALUES = 0.83
Case Is > 55: LTDVALUES = 0.979
End Select
Case 3: Select Case AGE
Case Is < 35: LTDVALUES = 0.433
Case 35 To 44: LTDVALUES = 0.56
Case 45 To 54: LTDVALUES = 0.678
Case Is > 55: LTDVALUES = 0.723
End Select
Case 4: Select Case AGE
Case Is < 35: LTDVALUES = 0.844
Case 35 To 44: LTDVALUES = 0.998
Case 45 To 54: LTDVALUES = 1.234
Case Is > 55: LTDVALUES = 1.39
End Select
Case 5: LTDVALUES = 0
End Select
End Function