Complex example

This checker aims to calculate the net tax payable by an individual. This example is modelled after the IRAS 2020 Income Tax Calculator for Tax Resident Individuals.

What this example features:

  1. Use of Max/Min functions

  2. Several levels of calculations informed by other calculations

  3. Different methods of building logic

  4. Making bands with logic

Calculator structure

Calculations must be done in order as previous calculations are used in later calculations.

  1. *Net employment income + Trade, Business, Profession or Vocation income + *Other income = Total income

  2. Total income - Approved donations = Assessable income

  3. Assessable income - *Total personal reliefs = Chargeable income

  4. Tax payable on chargeable income - Parenthood tax rebate = Net Tax Payable

*Net employment income = + Employment income - Employment expenses

*Other income = + Dividends + Interest + Rent from Property + Royalty, Charge, Estate/Trust Income + Gains or Profits of an Income Nature

*Total personal reliefs (Capped at $80,000) = + Earned income relief + Spouse/handicapped child relief + Qualifying/handicapped child relief + Working mother's child relief + Parent/handicapped parent relief + Grandparent caregiver relief + Handicapped brother/sister relief + CPF/provident Fund relief + Life Insurance relief + Course fees relief + Foreign domestic worker levy relief + CPF cash top-up relief (self, dependant and Medisave account) + Supplementary Retirement Scheme (SRS) relief + NSman (Self/wife/parent) relief

Step 1: Set questions

Step 2: Total income logic

Net employment income

= Employment income (N1) - Employment expenses (N2)

If the outcome is positive, i.e. employment income > expenses, we want to factor that into our formula.

If the outcome is negative, i.e. employment income < expenses, we don't want to factor a negative number into our calculation. Instead, we will take it as zero.

Thus the max function helps us to choose: Between (N1-N2) and 0, take the higher number

max(N1 - N2, 0)

Total income

We'll add the above Net employment income result (O1) to the rest of the inputs to calculate the total income.

= Net employment income (O1) + Trade, Business, Profession or Vocation income (N3) + Other income ( + Dividends (N4) + Interest (N5) + Rent from Property (N6) + Royalty, Charge, Estate/Trust Income (N7) + Gains or Profits of an Income Nature (N8) )

O1 + N3 + N4 + N5 + N6 + N7 + N8

Step 3: Assessable income logic

= Total income (O2) - Approved donations (N9)

If the outcome is positive, i.e. total income > approved donations, we want to factor that into our formula.

If the outcome is negative, i.e. total income > approved donations, we don't want to factor a negative number into our calculation. Instead, we will take it as zero.

Thus the max function helps us to choose: Between (O2-N9) and 0, take the higher number

max(O2 - N9, 0)

Step 4: Chargeable income logic

= Assessable income - Personal reliefs

Personal reliefs (Capped at $80,000)

Some of the personal reliefs have a cap to them. Hence for these inputs, we'd want to ensure that we do not factor in a number larger than the cap.

Thus the min function helps us to choose: Between (Eligible relief) and (Max cap of relief), take the lower number

min(N10, 12000) + min(N11, 5500) + N12 + N13 + min(N14, 28000) + min(N15, 3000) + N16 + N17 + min(N18, 5000) + min(N19, 5500) + min(N20, 6360) + min(N21, 14000) + min(N22, 35700) + min(N23, 5750)

The max cap of total personal reliefs is also $80,000. Hence, the min function helps us to choose: Between (Total personal reliefs) and (80000), take the lower number

min(total personal reliefs, 80000)

We can combine these two into the formula below:

min(min(N10, 12000)
+ min(N11, 5500)
+ N12
+ N13
+ min(N14, 28000)
+ min(N15, 3000)
+ N16
+ N17 
+ min(N18, 5000)
+ min(N19, 5500)
+ min(N20, 6360)
+ min(N21, 14000)
+ min(N22, 35700)
+ min(N23, 5750), 
80000))

Chargeable income

= Assessable income (O3) - Total personal reliefs (O4)

If positive, take that number. If negative, take it as 0.

max(O3-O4, 0)

Step 5a: (Method 1) Tax payable on Chargeable income logic

Tax is charged based on the band your chargeable income falls within. See the table below:

Tax is only charged for chargeable incomes > $20,000. Higher chargeable incomes have a higher base tax payable, and additional tax based on the difference between the base value and the next band value.

For example, if your chargeable income is $35,000, you fall into the second band:

Here's what it would look like:

First band: Tax Payable on first $30,000 = Tax charged on first $20,000 + (Next $10,000 x 2% Income Tax Rate) = 0 + (Chargeable income [O5] - 20000) x 0.02

IF    O5 > 20000
AND   O5 <= 30000 

THEN  (O5 - 20000) * 0.02
ELSE  0

Second band: Tax Payable on $30,000 to $40,000 = Tax charged on first $30,000 + (Next $10,000 x 3.5% Income Tax Rate) = 200 + (Chargeable income [O5] - 30000) x 0.035

IF    O5 > 30000
AND   O5 <= 40000

THEN  (200 + ((O5 - 30000) * 0.035)) 
ELSE  0

Tenth band: Tax Payable on $320,000 onwards = Tax charged on first $320,000 + (Next $ x 22% Income Tax Rate) = 44550 + (Chargeable income [O5] - 320000) x 0.22

IF    O5 > 320000

THEN  (44550 + ((O5 - 320000) * 0.22)) 
ELSE  0

Tax Payable on Chargeable Income

To calculate the gross tax payable, we can simply add up all the outcomes from each band together.

O6 + O7 + O8 + O9 + O10 + O11 + O12 + O13 + O14 + O15

Here's what that formula would look like a chargeable income of $165,000:

Gross tax payable = O6 + O7 + O8 + O9 + O10 + O11 + O12 + O13 + O14 + O15 = 0 + 0 + 0 + 0 + 0 + (13950 + ((165000 - 160000) * 0.18)) + 0 + 0 + 0 + 0 = $14,850 gross tax payable

However this is not the only way of building our logic. There are many ways we can interpret the table, and hence there are also other ways to translate it into logic. Let's look at an alternative example below.

Step 5b: (Method 2) Tax payable on Chargeable income logic

Another way to look at the total tax payable is to break down your chargeable income into the different increments, and applying the relevant tax rate to that increment.

For example, $400,000 chargeable income can be broken down into:

Hence, we can simply add all of the tax for each increment together.

Instead of using the entire band range as our IF statement conditions, as long as chargeable income (O5) is higher than the minimum value in the band, we want to apply the tax rate to O5. Hence, we only need to set IF O5 > 20000.

Because O5 can either cross the full increment value or its partial value, we would use a min function to choose the lower of the 2 values: Either the partial increment tax, or the full increment tax.

min((O5 - 20000) * 0.02, 10000 * 0.02)

Else if chargeable income doesn't fall within the range set, i.e. the condition is not fulfilled, we don't want anything to be added, hence it should be taken as 0.

Here's what it would look like:

First increment: Tax Payable on first $30,000 ($10,000 increment)

If chargeable amount > 20,000, = Tax charged on O5 - 20000 (Should be less than $10,000) OR Tax charged on $10,000 = ( Chargeable income [O5] - 20000 ) * 0.02 OR 10000 * 0.02 = Take whichever is lower

IF    O5 > 20000

THEN  min((O5 - 20000) * 0.02, 10000 * 0.02)
ELSE  0

Second increment: Tax Payable on $30,000 to $40,000 ($10,000 increment)

If chargeable amount > 30,000, = Tax charged on O5 - 30000 (Should be less than $10,000) OR Tax charged on $10,000 = ( Chargeable income [O5] - 30000 ) * 0.035 OR 10000 * 0.035 = Take whichever is lower

IF    O5 > 30000

THEN  min((O5 - 30000) * 0.035, 10000 * 0.035) 
ELSE  0

Tenth increment: Tax Payable on $320,000 onwards (No more increments)

If chargeable amount > 320,000, = Tax charged on O5 - 320000 = ( Chargeable income [O5] - 320000 ) * 0.035

Tax Payable on $320,000 onwards
IF    O5 > 320000

THEN  (O5 - 320000) * 0.22
ELSE  0

Tax Payable on Chargeable Income

As mentioned above, to calculate the gross tax payable we add up each increment tax together.

O6 + O7 + O8 + O9 + O10 + O11 + O12 + O13 + O14 + O15

Here's what that formula would look like a chargeable income of $165,000:

Gross tax payable = O6 + O7 + O8 + O9 + O10 + O11 + O12 + O13 + O14 + O15 = (10000*0.02) + (10000*0.035) + (440000*0.07) + (40000*0.115) + (40000*0.15) + (5000*0.18) + 0 + 0 + 0 + 0 = $14,850 gross tax payable

Step 6: Net tax payable logic

= Tax payable on chargeable income (O16) - Parenthood tax rebate (N24)

O16 - N24

Preview

You can try out this checker here.

Last updated