How to calculate taxable income from taxed income
I needed a function to do this to help me do my budget. It was PITA to write so I’m sharing it in case other people find it useful.
Here are versions in perl, python and OpenOffice/MS Office macros. There are also functions to do the reverse, and some extra cruft, but it’s still there.
(I started with the perl version because I didn’t want to be distracted by an unfamiliar language, wrote the office version because I wanted it to work in my spreadsheet, and wrote the python version beause I thought openoffice supported python macros and I wanted to use a real language)
Basically the way it works is do approach the taxed vs untaxed income graph as a series of straight intervals, and finds the one that is intercepted by the taxed-income line in question. The tricky part was figuring out the numbers for each line, given a list of the tax brackets and medicare levy thresholds (well, threshold).
The result is actually ambiguous for a small region around the $50k (taxable) mark, because when your taxable income hits $50k and you get the medicare surcharge, it’s an instant $500 jump in tax. The function returns the lowest taxable income for the taxed income passed in these cases.
The tables in the functions are for the 2006/2007 tax year, and have the medicare brackets set assuming you do have to pay the surcharge (ie don’t have health insurance).
Anyway, hope someone out there finds it useful.