+ Start a Discussion
Max75Max75 

Multiple IF statements and MID function

Hi guys.

I'm struggling with a formula:

IF( Sales_Company__c = "FI", MID(ProductCode, 4, 12), ProductCode)

Now I need to add in another parameter in Sales Company. It should be both A1 and FI. 

I think I'm blanking out here.
Best Answer chosen by Max75
Kumaresan.ManickamKumaresan.Manickam
It's simple:
IF( OR(Sales_Company__c = "AI",Sales_Company__c = "FI"), MID(ProductCode, 4, 12), ProductCode)

Refer the formula related articles worth to go through for more help: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5

Choose this reply as best answer if solves your problem.

Cheers!!

All Answers

Kumaresan.ManickamKumaresan.Manickam
It's simple:
IF( OR(Sales_Company__c = "AI",Sales_Company__c = "FI"), MID(ProductCode, 4, 12), ProductCode)

Refer the formula related articles worth to go through for more help: https://help.salesforce.com/articleView?id=customize_functions.htm&type=5

Choose this reply as best answer if solves your problem.

Cheers!!
This was selected as the best answer
Max75Max75
Thanks for the answer!

Using the suggested formula gives the correct value when Sales Company is FI but not when A1.
Suggestion?
Kumaresan.ManickamKumaresan.Manickam
As per my understanding, you want to strip the product code if in case of sales company is either A1 or F1, or else it will return you full product code. Is my understanding is correct. 
Max75Max75
Yes. And using the suggestion it strips product code when FI is used but not when A1
Kumaresan.ManickamKumaresan.Manickam
Is the sales company A1 or AI. Please check if its 1 or I at last. I think the problem is with hard coded value you used, please check once
Max75Max75
Well look at that! It was a I intstead of a 1 in A1.

Thank you so much! True superstar!
Kumaresan.ManickamKumaresan.Manickam
Thank you!!