Help

IF formula help!

Topic Labels: Formulas
1943 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Borg
4 - Data Explorer
4 - Data Explorer

Hello! I am having trouble with what I think would be an IF formula, but maybe a switch?

These are my fields:
Product
Unit Price
Shipping Cost

We have our shipping costs listed as a line item and it will show in the product column. I need to extract the shipping cost for our P/L down the road. What I am looking to do is:

IF the product is “shipping” , I want to show the unit cost in the Shipping Cost field…

Can’t quite figure it out…Thank you for your help

5 Replies 5

You are correct, either an IF() or a SWITCH() will do. Set your {Shipping Cost} field to be a formula field using either of these:

IF({Product} = "shipping", {Unit Price})
or
SWITCH({Product}, "shipping", {Unit Price})

You’ll also need a similar formula in your {Unit Cost} field to not show the cost when the product is “shipping.” The IF() option is easier in this case because you’re trying to exclude that one item.

IF({Product} != "shipping", {Unit Price})

Thanks! The formulas did not return an error, but they are also not showing the shipping cost in the shipping column. I’m not sure why not…

Screen Shot 2020-05-30 at 2.09.37 PM Screen Shot 2020-05-30 at 2.08.36 PM

Can you provide a screenshot showing the {Product} and {Unit Price} fields?

I included “shipping” with a lower-case S in my formulas because that’s what you mentioned in your first post. However, looking at the record names, they show “Shipping” with a capital S. Airtable is case-sensitive, so change all “shipping” references in the formulas to “Shipping” and it might work.

If that doesn’t do it, leave that change in, and check the field type of your {Product} field. If it’s a link, is the full name in the linked record just “Shipping” on its own, or is there other text around it? If it’s the latter, then you’ll need to look for “Shipping” in the linked record name, instead of looking for an exact match to that name. For the {Shipping Cost} field, the formula would become:

IF(FIND("Shipping", Product), {Unit Price})

But again, only try this second change if the first one (fixing the string case) doesn’t work.