Help

Re: Nested IF stmt to calculate a tax rate

644 0
cancel
Showing results for 
Search instead for 
Did you mean: 
JBorg
4 - Data Explorer
4 - Data Explorer

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.

1 Reply 1

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%')))