Nested Select Case ERROR

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!

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
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Work fine for me. Presumably, this is a UDF. Have you cecked the spelling in the function call?
 
Upvote 0

Forum statistics

Threads
1,216,473
Messages
6,130,838
Members
449,597
Latest member
buikhanhsang

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top