WindsorKnot
Board Regular
- Joined
- Jan 4, 2009
- Messages
- 160
Hi,
I need some help on error handling my function below. (I've only copied part of the function to keep it simple)
The function works fine, but if a tier is selected that isn't an option, the function returns a value of 0. Is there anyway to have the function return a #Value or #NA value if a valid tier is not selected?
Thanks.
I need some help on error handling my function below. (I've only copied part of the function to keep it simple)
The function works fine, but if a tier is selected that isn't an option, the function returns a value of 0. Is there anyway to have the function return a #Value or #NA value if a valid tier is not selected?
Thanks.
Code:
Function HIGHPLAN(tier As String, Sal As Currency)
Dim CONTRIB As Currency
EEPERCENT = 0.022
EE1PERCENT = 0.027
EE2PERCENT = 0.034
EE3PERCENT = 0.044
Select Case tier
Case Is = EE: Select Case EEPERCENT * Sal
Case 0 To 360: CONTRIB = 360
Case 360.01 To 1379.99: CONTRIB = EEPERCENT*Sal
Case Is >= 1380: CONTRIB = 1380
End Select
Case Is = EE1: Select Case EE1PERCENT * Sal
Case 0 To 720: CONTRIB = 720
Case 720.01 To 2759.99: CONTRIB =EE1PERCENT*Sal
Case Is >= 2760: CONTRIB = 2760
End Select
End Select
HIGHPLAN = CONTRIB