Hello Everyone

I'm trying to come up with an efficient formulae or function to calculate tax
The problem I have is that the tax is progressive. As below
the first 20,000 is taxed at 5%
the next 20,000 is taxed at 6%
the next 20,000 is taxed at 7%
the next 20,000 is taxed at 8%
the next 20,000 is taxed at 9%
more than 100,000 is taxed at 10%

I'm trying to do a formula like below
Cell B3 is my taxable amount
Cell B5 =IF(B$3>20000,20000*0.05,B$3*0.05)
Cell B6 =IF(B$3>40000,40000*0.05,(B$3-20000)*0.05)

This gives me a problem in that for 35k say, I end up with a negative number
for the second part in cell B6
My other issue is that each calculation will take up 6 rows on my
spreadsheet. I was hoping to set up a function that could do this in a cell,
but even the simple stage defeats me at the moment.

Thanks for reading this far and any help would be greatly appreciated

Thank you