I am looking for a small program which will calculate my wages. For
> example, I key in all the relevant details like tax code, week no. tax
> rate, NI rate, etc and it should show my correct net wage.
Prompted by this query, I thought I'd have a look at what would be involved in cobbling such a program together myself.
The challenge, it seems, lies in getting exactly the same answer as the one you'd get if using the IR's published tables, instead of an answer which is, if you like, "more correct" but actually a few pence off the "official" answer. The solution therefore involves knowing what the algorithm is which IR use to compile their tax tables, since clearly it would be inelegant (not to mention laborious) simply to absorb their tables into the program.
The pay adjustment tables ("Tables A"), which give the pro rata weekly or monthly allowance to be deducted from pay to date (or added to it, in the case of K codes), given the employee's tax code and the week or month number, appear to have used the following recipe:
If the tax code is 0, the adjustment is 0, whatever the week or month.
Otherwise, for codes 1 to 500, the pay adjustment for the whole year (i.e. cumulatively in month 12 or week 52) is ten pounds times the code, plus nine pounds, plus a number of pence, if necessary, to make the total number of pence divisible by 12 or 52 as the case may be.
For any month or week other than 12 or 52, the cumulative adjustment is that for the year divided by 12 or 52, times the month or week number.
The 500 increment applied to codes 501 and above is dealt with similarly, by rounding £5000 up to the next number of pence divisible by 12 or 52.
So far, so good. The rest, applying the starting, basic, and higher rate tax rates, should be easy.
But AARGH! I'm flummoxed by something in the other tables. Looking at the "calculator tables", based on the starting/basic and basic/higher rate boundaries being £1960 and £30500 (these are 2003-04 boundaries, the 2004-05 tables don't seem to be available yet), it's clear that the SR table which seeks to apportion £1960 to its monthly or weekly equivalent is simply £1960 divided by 12 or 52 and rounded up, if not whole, to the next higher whole pound. The same is true of table B (and C, which is the same), you divide £30500 by 12 or 52 and round up to the next whole pound.
Now, to calculate tax where £1960 < pay £30500, you take 40% of the excess, and add £6474.80 (which is 22% of £30500 minus 12% of £1960). Now I'd expect the add-on entries in the table which pro-rates £6474.80 to be a 12th of that, rounded up to the next whole penny, but no. The figures in the official table are 12p more for months 1, 4, 7, 10, and
25p more for months 2, 5, 8, 11, but correct for months 3, 6, 9, 12.
Why?
Similarly for the weekly scheme, the add-on table figures are off from the obvious algorithm by 17p in week 1, 35p in week 2, 14p in week 3, and continuing 32p, 11p, 30p, 8p, 26p, 5p, 23p, 3p, 11p, but then correct for week 13. I haven't looked at them all, but it seems the pattern repeats so that week 14 is 17p out just like week 1; week N is out by the same amount as week N-13.
I can't quite figure it out. Any ideas?