Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here
Sep 16, 2022 07:53 AM
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.
Sep 16, 2022 02:35 PM
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%')))