# Nested IF stmt to calculate a tax rate

I’m trying to create a formula field that’ll output a sales tax amount based on another field in the base.

So:
IF {Tax Type} = HST, multiply {Subtotal} by 13%,
IF {Tax Type} = GST, multiply {Subtotal} by 5%,
IF {Tax Type} = “Zero-rated”, type “0%”, else leave BLANK

I’ve tried several iterations of this nested IF statement and always have issues.

The latest was:
IF(
{Tax Type} = “HST”, “13%”,
IF(
{Tax Type} = “GST”, “5%”,
IF({Tax Type} = “Zero-rated”,
“0%”, BLANK
)
)
)

And I keep getting errors about the closing parenthesis, however, this was based on the Airtable Support article for nesting three or more IF statements in a row, so I’m confused.

Can anyone help? Thx.

Hi @JBorg,
The SWITCH formula is much nicer to type than nested IF formulas. This will work for your case above

``````SWITCH({Tax Type},
'HST', (Subtotal*.13),
'GST', (Subtotal*.05),
'Zero-rated', '0%',
'')
``````

Also here is your nested IF fixed. You were not multiplying anything and you have too many arguments in your last statement.

``````IF({Tax Type} = 'HST', (Subtotal*.13),IF({Tax Type} = 'GST', (Subtotal*.05),IF({Tax Type} = 'Zero-rated','0%')))
``````
1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.