Hello!
I would like to ask you what is wrong in my code, because I do not know what happened.
In the table I have 2 columns: Salary and Has Kids (Do someone have children?).
My macro take Salary and answer from columns Has Kids (Yes or No) and give particularly TaxRate.
I have problem because for example: If I have Salary 3000 and "Yes" in columns Has Kids, macro give me that result: 0.01 (It should be 0).
Please help me, because I do not know what do I wrong.
Sorry for my English mistakes
Function getTaxRateElseNestedIF(Salary As Double, HasKids As String) As Double
If Salary > 5000 And Salary < 40000 Then
If HasKids = "Yes" Then
getTaxRateElseNestedIF = 0.15
Else
getTaxRateElseNestedIF = 0.25
End If
ElseIf Salary >= 40000 And Salary < 90000 Then
If HasKids = "Yes" Then
getTaxRateElseNestedIF = 0.28
Else
getTaxRateElseNestedIF = 0.35
End If
ElseIf Salary > 90000 Then
If HasKids = "Yes" Then
getTaxRateElseNestedIF = 0.42
Else
getTaxRateElseNestedIF = 0.45
End If
Else
If HasKids = "Yes" Then
getTaxRateElseNestedIF = 0
Else
getTaxRateElseNestedIF = 0.01
End If
End If
End Function