Excel macro to calculate Swiss Income tax

How do you write a macro in Excel which calculated Swiss Income tax, any excel wizards out there ?

Why would you need a macro for that? A table with the tax rates, your taxable income and a simple formula is enough.

Or what exactly are you trying to do?


Yes, a formula is good too :slight_smile:

Total Salary is X, Take Home Salary after deducting income tax is X.

Which canton? I have some Python code for ZH and SZ.

See Tax Simulation DIY - #10 by the_p


You need the taxable salary, after all the deductions, not the total salary. Deductions depend on your individual situation.

Once you have your taxable salary, you can download the tax tariffs here → Cookie Not accepted

Then check in which bracket your income falls, e.g. 70’000 taxable income is between 50’000 and 100’000, so the lower threshold is 50’000. In the row with 50’000 in the column “Grundbetrag” is the value you pay for 50’000 and below and the column “Zusätzlich %” shows how much you pay on the 20’000 above the lower threshold.

The same can be done for the federal taxes.

FYI, there’s also a calculator from the tax authorities here → Cookie Not accepted


This is a great resource, thanks for sharing.

Is it possible to create a formula once you have the taxable salary after decuctions or is it too complex ?

Just to answer another question, i’d like to calculate for the ZRH canton, although I may well calculate for ZUG too as I want to see how much greener that the grass is on the other side.

1 Like

Sounds like 2 XLOOKUP.s, should be fairly easy :wink:

1 Like

Exactly, @joker I can provide you my Excel sheet incl. the formulas tomorrow when I have access to a PC.

1 Like

I quickly hacked together an Excel to calculate federal and cantonal/municipal taxes for ZH and ZG. The assumptions are single, unmarried, no children.

You can choose the canton, municipality and religion and it calculates the taxes for 2021.

@joker please provide me your E-Mail address via PM, so I can send it to you.

If anyone else is interested, would be great if someone has a dropbox or google drive to share it with everyone.

@joker thanks for showing me transfer.sh. I uploade the file here → https://transfer.sh/Iwf7kM/income%20tax%20calculator%20ZG%20ZH.xlsx


Would it be possible to fix the dropdown so that I can select ZH and calculate the return ?
Currently, the tax multiplier and tax amount says N/A when selecting ZH.

You need to choose ZH and then also adjust the municipality, the available municipalities should populate automatically based on the chosen canton.

Otherwise let me know so that I can fix it, but I’ll only be able to do it next week as I became a father on Wednesday :slight_smile:


I tried to edit the formula but failed, so will need to wait, for when you have time.

Oh wow - congrats to the new family, that’s fantastic news. Happy times ahead!

1 Like


I just tried the Excel on my phone and the dropdowns are working as expected, firatvI choose the canton ZH and then e.g. the municipality Adliswil.

1 Like