function not functioning


Posted by dr jay on January 04, 2002 9:39 AM

i am creating a function to calculate a tax value based off of income. However once the variable does not meet the first value condition i get a #value! error in excel. What is wrong with the below code:

Function tax(tax_income)
select case tax_income
case is < 20000
tax = tax_income * .015
case is 20000 to 100000
tax = tax_income * .037
case else tax = 0
end case
end function



Posted by Russell Hauf on January 04, 2002 9:44 AM

Try this (hope it helps):

Function tax(tax_income)
Select Case tax_income
Case Is < 20000
tax = tax_income * 0.015
Case 20000 To 100000
tax = tax_income * 0.037
Case Else
tax = 0
End Select
End Function


value based off of income. However once the variable does not meet the first value condition i get a #value! error in excel. What is wrong with the below code: