 # If, then formula for percentage calculation

Hi, I’m wondering if there’s a way to do this. I have a table with the category of a used book and the original price. I want to create a formula that calculates the selling price based on the category of the book. So it would be IF category = A then take Original Price and deduct 30% to get the selling price. I’m not sure if I can do all of this in one go with an IF formula. But maybe I can do part of it? Thanks for the help!

Hi @Ons_Stories,

Yes you can do that. You would use a nesting IF formula. Something like IF({Category}=A, Price0.7, if({Category}=B, Price0.75, … and so on

And so on.

This formula can be a little tricky, if you need help with it just let me know. I will need to see a screenshot of your table and know what you are trying to achieve with that formula.

BR,
Mo

Thanks, but yeah this didn’t help. It says there’s a problem with the formula and I’m not sure how to fix it. In the screenshot below you’ll see what I typed in the formula. I’m trying to formulate 70% of the Original Price IF Category = A and IF Category = B then 60% and so on!

It won’t let me upload screenshots, sorry

You can do this much more efficiently with a `SWITCH()` function:

``````{Price} *
SWITCH(
{Category},
"A", 0.7,
"B", 0.6,
"C", 0.8
)
``````
1 Like

That worked thanks a lot!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.