function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AlizehSAlizehS 

Formula field query

Hi All,
I am trying to create a formula field based on the below conditions :

1. If the course name field contains value Platform Cerfification then the formula field should display value "Platform Cerfification".
2. If the course name field contains value Sourcing Cerfification then the formula field should display value "Sourcing Cerfification".
3. If the course name contains a version character namely v,v.1,v.2,v.3,v.4,v.5, it should display the entire string without the v's in it.
4. Additionally if none of the above conditions are satisfied then the formula field should display e-learning.

I'm currently using the below formula to achieve points 1, 2 but stuck at 3 and 4 :
IF(CONTAINS( LearnUponP__Course_Name__c , "Platform Certification"), "Platform Certification",
IF(CONTAINS( LearnUponP__Course_Name__c , "Sourcing Certification"), "Sourcing Certification",

Any ideas how I can achieve this ?
#formulas
Best Answer chosen by AlizehS
VinayVinay (Salesforce Developers) 
Hi Alizeh,

Try below formula.
IF(
    CONTAINS(LearnUponP__Course_Name__c , "Platform Certification"),
    "Platform Certification",
    IF(
        CONTAINS(LearnUponP__Course_Name__c , "Sourcing Certification"),
        "Sourcing Certification",
        IF(
            CONTAINS(LearnUponP__Course_Name__c , "v")|| CONTAINS(LearnUponP__Course_Name__c , "v.1")|| CONTAINS(LearnUponP__Course_Name__c , "v.2")
            || CONTAINS(LearnUponP__Course_Name__c , "v.3")|| CONTAINS(LearnUponP__Course_Name__c , "v.4")|| CONTAINS(LearnUponP__Course_Name__c , "v.5"),
			"v,v.1,v.2,v.3,v.4,v.5",
            "e-learning"
        )
    )
)
Please mark as Best Answer if above information was helpful.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Alizeh,

Try below formula.
IF(
    CONTAINS(LearnUponP__Course_Name__c , "Platform Certification"),
    "Platform Certification",
    IF(
        CONTAINS(LearnUponP__Course_Name__c , "Sourcing Certification"),
        "Sourcing Certification",
        IF(
            CONTAINS(LearnUponP__Course_Name__c , "v")|| CONTAINS(LearnUponP__Course_Name__c , "v.1")|| CONTAINS(LearnUponP__Course_Name__c , "v.2")
            || CONTAINS(LearnUponP__Course_Name__c , "v.3")|| CONTAINS(LearnUponP__Course_Name__c , "v.4")|| CONTAINS(LearnUponP__Course_Name__c , "v.5"),
			"v,v.1,v.2,v.3,v.4,v.5",
            "e-learning"
        )
    )
)
Please mark as Best Answer if above information was helpful.

Thanks,
This was selected as the best answer
AlizehSAlizehS
Hey Vinay, thank you so much for the formula. Looks like it works great for all conditions except for condition number 3. 
For example : If the course name = Business Analyst v.2 then the formula field should display only Business Analyst. It should ignore the version in the course name. Any help would be much appreciated. 
VinayVinay (Salesforce Developers) 
Above formula will not ignore version character, try using TRIM function to ignore last 3 characters of field. Something like below.
TRIM(RIGHT(LearnUponP__Course_Name__c , 3))
https://help.salesforce.com/s/articleView?id=sf.customize_functions_trim.htm&type=5

Thanks,
AlizehSAlizehS
Thank you so much Vinay. I am yet to test how this behaves in my enviornment but appreciate your help !