I am trying use “IF” statements to make a single formula that will calculate a person's taxable income assuming the six different marginal tax rates that range from 10% to 35%, as income increases; the formula

For a single taxpayer, the marginal tax rates and the associated income amounts are:
10% up to $8,350
(e.g., income tax for income of $5,000 is $500)

15% up to $33,950
(e.g., income tax for income of $10,000 is $8,350*10% + $1,650*15% = $747.50)

25% up to $82,250

28% up to $171,550

33% up to $372,950

35% over $372,950

I am using "IF" statements to test for each marginal tax rate.
I began the formula as follows, but it returns a value error.
Cell D36 is the taxpayer's income
=IF(D36<=8350,D36/10),IF(AND(D36>8350,D36<=D31),SUM(D36/10,D36/6.666))