Functions to calculate income tax, RRIF payments, and OAS clawback

Public Function taxation(income)

If income = 0 Then
taxation = ""

ElseIf income <= 10000 Then
taxation = 0.077 * income

ElseIf income > 10000 And income <= 38000 Then
taxation = 0.201 * income

ElseIf income > 38000 And income <= 41000 Then
taxation = 0.241 * income

ElseIf income > 41000 And income <= 42000 Then
taxation = 0.263 * income

ElseIf income > 42000 And income <= 67000 Then
taxation = 0.312 * income

ElseIf income > 67000 And income <= 68000 Then
taxation = 0.317 * income

ElseIf income > 68000 And income <= 74000 Then
taxation = 0.33 * income

ElseIf income > 74000 And income <= 75000 Then
taxation = 0.339 * income

ElseIf income > 75000 And income <= 80000 Then
taxation = 0.386 * income

ElseIf income > 80000 And income <= 85000 Then
taxation = 0.431 * income

ElseIf income > 85000 And income <= 125000 Then
taxation = 0.434 * income

ElseIf income > 125000 And income <= 130000 Then
taxation = 0.457 * income

ElseIf income > 130000 Then
taxation = 0.464 * income

Else: taxation = 0

End If

End Function

Public Function RRIF(age, amount)

If age < 71 Then
RRIF = 0

ElseIf age = 71 Then
RRIF = amount * 0.0738

ElseIf age = 72 Then
RRIF = amount * 0.0748

ElseIf age = 73 Then
RRIF = amount * 0.0759

ElseIf age = 74 Then
RRIF = amount * 0.0771

ElseIf age = 75 Then
RRIF = amount * 0.0785

ElseIf age = 76 Then
RRIF = amount * 0.0799

ElseIf age = 77 Then
RRIF = amount * 0.0815

ElseIf age = 78 Then
RRIF = amount * 0.0833

ElseIf age = 79 Then
RRIF = amount * 0.0853

ElseIf age = 80 Then
RRIF = amount * 0.0875

ElseIf age = 81 Then
RRIF = amount * 0.0899

ElseIf age = 82 Then
RRIF = amount * 0.0927

ElseIf age = 83 Then
RRIF = amount * 0.0958

ElseIf age = 84 Then
RRIF = amount * 0.0993

ElseIf age = 85 Then
RRIF = amount * 0.1033

ElseIf age = 86 Then
RRIF = amount * 0.1079

ElseIf age = 87 Then
RRIF = amount * 0.1133

ElseIf age = 88 Then
RRIF = amount * 0.1196

ElseIf age = 89 Then
RRIF = amount * 0.1271

ElseIf age = 90 Then
RRIF = amount * 0.1362

ElseIf age = 91 Then
RRIF = amount * 0.1473

ElseIf age = 92 Then
RRIF = amount * 0.1612

ElseIf age = 93 Then
RRIF = amount * 0.1792

ElseIf age >= 94 Then
RRIF = amount * 0.2

End If

End Function

Public Function clawback(age, income)

If age < 65 Then
clawback = 0

ElseIf income > 70954 Then
clawback = (income - 70954) * 0.15
12150
Else: clawback = 0

End If

If clawback > 546.07 * 12 Then
clawback = 546 * 12

Else

End If

End Function