Help

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

The formula if help

Topic Labels: Formulas
380 4
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello!
There is a column (category) with 3 categories (A, B, C)
And a column (total)
You need to create a formula:
If {category} = “A”, {total}*0.5, If {category} = “B”, {total}*0.1, If {category} = “C”, {total}*1)
But it doesn’t work for me.
thanks

4 Replies 4

You could use a nested IF() statement, the proper syntax would be something like:

IF({category} = "A", {total} * 0.5, IF(..., ..., IF(..., ...)))

Or you could use a SWITCH statement since you’re only looking at one field value.

SWITCH(
   {category},
   "A", {total} * 0.5,
   "B", {total} * 0.1,
   "C", {total} * 1,
)

Another way to write that SWITCH() function is to only use it to calculate the multiplier for {total}:

{total} * SWITCH(
   {category},
   "A", 0.5,
   "B", 0.1,
   "C", 1
)

thank you very much!
everything worked out

Glad to know that you got the answer you were seeking! If you would, please mark @Kamille_Parks’ comment above as the solution to your question (mine was just a variant of hers). This helps others who may be searching with similar questions. Thanks!