Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Max75

# 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.
Kumaresan.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

Cheers!!

Kumaresan.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

Cheers!!
This was selected as the best answer
Max75

Using the suggested formula gives the correct value when Sales Company is FI but not when A1.
Suggestion?
Kumaresan.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.
Max75
Yes. And using the suggestion it strips product code when FI is used but not when A1
Kumaresan.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
Max75
Well look at that! It was a I intstead of a 1 in A1.

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