Income Tax & Formulas Using Tax Slab

Hi,

I would like to setup income tax calculations using tax slabs. Our income tax calculation is as follows:

Annual Income Annual Income Tax
P0 – P36,000 P0
P36,001 – P72,000 5%
P72,001 – P108,000 P1,800 + 12·5% of excess over P72,000
P108,001 – P144,000 P6,300 + 18·75% excess over P108,000
P144,001 and above +P13,050 +25% of excess over P144,000

How do add formulas on the tax slabs to achieve this?

2 Likes

NO takers?

Where can I understand the condition & Formula syntax? Maybe I can do this using salary components.

1 Like

What have you found or tried, a search will turn up clue pointers

I have been able to achieve this using Salary Structure component (basically nested if statements)

I wanted to know if this can be achieved using tax slabs. We will have multiple salary structures and I don’t want to maintain this on every salary structure. If tax rules changes, then we have to make a lot of changes.

Hi @tefobw how did you put the P1,800, P6,300,and P13,050 on the tax slabs?

Hi,

I did not manage to get it done. Ended up using formula in salary component, but not happy with that approach. I would have preferred to use tax slabs instead.

You don’t need to use formulas on the tax slabs. Just put

From Amount To Amount Percent Deduction
0 36,000 0%
36,001 72,000 5%
72,001 108,000 12.5%
108,001 144,000 18.75%
144,001 0 25%

and ERPNext will do the calculations for you.

Hi Peter,

The formula isn’t exactly that way, e.g.

For the range P72,001 to P108,000 tax is P1,800 plus 12.5% of excess over P72,000.

The issue is including the constant amount in the calculation.

The constant amount is just the accumulated taxes for the lower brackets:

 1,800 = 5% * (72,000 - 36,000)
 6,300 = 5% * (72,000 - 36,000) + 12.5% * (108,000 - 72,000)
13,050 = 5% * (72,000 - 36,000) + 12.5% * (108,000 - 72,000) + 18.75% * (144,000 - 108,000)

This is how all marginal tax brackets work. ERPNext understands that and does the calculation automatically. This is exactly the situation the Income Tax Bracket doctype was designed to cover, no formulas needed!

2 Likes

Hi @tefobw

Is this solution from @peterg solve your problem?
Maybe you can share the result?
Thank you.

Similar question for Zambian tax brackets, I’m new to this forum so please excuse the formatting.
0 to 4000 at 0%
4001 to 4800 at 25%
4801 to 6900 at 30
6901 and above at 37.5 (this last slab is calculated at anything in excess of 6900 - 6900 * 37.5%)
If I get a salary of 12000 and use ERPNext tax slabs, I get calculated tax of 4353.62 when my tax calculator says I should pay taxes of 2742.5. I’ve read the discussions involving income tax calculations and the responses are not helpful to anyone who doesn’t have a coding background and doesn’t understand the syntax.

These are monthly brackets? And monthly payroll? If so, you should probably be setting this up in the salary structure directly rather than using tax slabs.

1 Like

Hi,
I join your pain since I faced same challenge then abandoned due to no help.

Regards
Nofal

2 Likes

Thanks for the response, Peter. The closest I’ve gotten to getting the PAYE salary component to work is with this formula which I gathered after reading several discussions:
gross_pay * 0 if (gross_pay < 4000) else 800 * 0.25 if (gross_pay > 4000.01 and gross_pay <= 4800) else 2100 * 0.30 if (gross_pay > 4800.01 and gross_pay <= 6900) else (gross_pay - 6900) * 0.375 if (gross_pay > 6900) else 0.
With this formula when I add the PAYE component to any salary structure, it only returns a single value that meets the given conditions so I thought the income tax slabs could help with this problem but they’re not returning the right value either so either I give up or learn python it seems :smiling_face_with_tear:

The syntax for conditions and formulas is pretty basic. I think that’s the issue you might be running into here. It’s possible to do everything you’re trying to do in a single salary component with a giant formula, but it’s messy. Far simpler would be to just create three different salary components, each with a different condition:

name condition formula
s1 base>4000 and base<=4800 (base-4000)*0.250
s2 base>4800 and base<=6900 (base-4800)*0.300 + 200
s3 base>6900 (base-6900)*0.375 + 830

Stick them all in a salary structure and you’re good to go. I just tested on my local system and, assigning 12000 base salary, got 2742.5 income tax. There are other ways to do it, but if you’re not comfortable with complex/nested logic this is by far the simplest.

5 Likes

Thanks for all the help, Peter. I tried this and it worked :smiley:

Hi Peterg,

Please clarify for me. If the salary slabs are entered as annual amounts, will they automatically be calculated for monthly payroll as deductions?

Yes, correct. There are a few assumptions that go into how the calculation is made, but for most use cases it works well.

Thank you.

I agree. Nested formulas in the salary structure itself is the way to go. Tax slabs seems to be geared towards annual calculations and it’s pretty confusing to apply it to monthly calculations especially for countries that have non-taxable income within their base pay.