Income Tax & Formulas Using Tax Slab

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.

This is the challenge I was trying to avoid by using tax slabs and not nested formulas.

I wanted to make it easier to update tax rates whenever these are amended by Govt.

My scenario is such that different employees have different salary structures and therefore I had to create for than one structure.

E.g.

Employee 1(group of employees): basic salary=10,000 housing = 3,000 car = 2500
Employee 2: basic = 12500, housing 4500 car = 1500
Employee 3: 15000, housing=2500, car = 3000

Not sure if I can use one salary structure and assign different values on salary structure assignment.

Tax is on the gross amount above. My solution was to create different salary structures. Wanted to use tax slabs to make it easier to update tax rates (I know they don’t change a lot, but doing this on multiple salary structures is prone to errors in my opition).

This is why Tax Slabs exists.

The tax calculated has nothing to do with the salary structure, but the gross pay as you rightly pointed.

For the breakups in the salary itself, creating multiple structures is the way to go. On top of that, you can create a salary structure in three ways:

  1. Directly add all the amounts.
  2. Add only the basic pay (a component) and derive all formulas based on that.
  3. Add a base pay in Salary Structure Assignment, and in the structure itself, write formulae only.

If there are any components which should fall outside the purview of taxes (tax should not be calculated on these) you can uncheck Is Tax Applicable in the Salary Component.

Right, like @kennethsequeira has said, for your circumstances, you don’t need to calculate nested formulas. @Stella had a different situation than yours, where income tax was calculated on a monthly- rather than yearly-basis. For yearly basis, tax slabs are the way to go.

Hi @peterg .

I seem to have stumbled upon the same situation in this thread, more/less so. I had opened a topic earlier on here: Small Feature Request on Income Tax Calculation

For me, putting the Income Tax in the Salary Structure/Components won’t work, because this is how the tax is supposed to be calculated:

  1. Determine gross income for the day/week/month/year.
  2. Deduct exempt income, for instance bonus: You get => Income
  3. Deduct allowable deductions, e.g. pension: You get => Taxable Income.
  4. Please refer to tax table(s) as shown in the linked topic. You get => Tax on Taxable Income.
  5. Deduct tax credits e.g. elderly, blind or disabled persons ($750.00) and medical credit $1.00 of every $2.00 paid: You get => Tax after credits.
  6. Calculate 3% Aids Levy and add to tax after credits: You get actual tax payable.

So as I stated in the new thread, this can be solved if there is a way to add a formula to the Tax Slab items, then additional deductions like Aids Levy above, can be added in the child table after the tax slabs.

NOTE: For my case this tax will need to be applied monthly whenever payslips are created

Hi @redgren. I’ve answered in the other thread. You indicate that salary structure components won’t work, but I don’t really see why not. Happy to discuss here or there.

please , I am falling in the same problem and the missed thing to me to complete my understanding is that where 200 and 830 comes from . And what you mean by monthly brackets

Hi there,
I was responding to a person for whom income taxes were assessed monthly, so the different brackets that were listed were calculated for monthly income (not yearly income, as is usually the case).

200 and 830 are the totals of the previous marginal brackets. The first tax bracket (25%) applies to the $800 between $4000 and $4800. The second bracket (30%) applies on the $2100 between $4800 and $6900.

  • 25% of 800 = 200 (maximum amount paid for first marginal bracket)
  • 30% of 2100 is 630 (maximum amount paid for second marginal bracket)
  • 630 + 200 = 830 (sum of first and second marginal brackets)
2 Likes

Thank you for your reply .I can now understand what I should do on my case . Thank you again my bro

1 Like

income tax is not deducting evenly in monthly salary slip i want it evenly trough out the year