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
Phillip MoseleyPhillip Moseley 

Need help with Writing a Picklist Value Formula

Trying to create a Picklist Value formula field that will cover 14 tiers. I have the first part done, but I need it to include up to 14 tiers.

So I have  If(ispickval(Opportunity.Tier__c , "1"), 1,0) which is correct, but I need this to go up to 14 tiers.

Something like this, but I'm not sure how to write it. Any help would be appreciated. Thanks,

If(ispickval(Opportunity.Tier__c , "1"), 1,0)
If(ispickval(Opportunity.Tier__c , "2"), 2,0)
If(ispickval(Opportunity.Tier__c , "3"), 3,0)
If(ispickval(Opportunity.Tier__c , "4"), 4,0)
If(ispickval(Opportunity.Tier__c , "5"), 5,0)
If(ispickval(Opportunity.Tier__c , "6"), 6,0)
If(ispickval(Opportunity.Tier__c , "7"), 7,0)
If(ispickval(Opportunity.Tier__c , "8"), 8,0)
If(ispickval(Opportunity.Tier__c , "9"), 9,0)
If(ispickval(Opportunity.Tier__c , "10"), 10,0)
If(ispickval(Opportunity.Tier__c , "11"), 11,0)
If(ispickval(Opportunity.Tier__c , "12"), 12,0)
If(ispickval(Opportunity.Tier__c , "13"), 13,0)
If(ispickval(Opportunity.Tier__c , "14"), 14,0)
Best Answer chosen by Phillip Moseley
kaustav goswamikaustav goswami
You can go for a nested IF statement. The format will be something like this -

IF('CONDITION', TRUE VALUE, NEXT IF)

Example:

IF(ISPICKVAL(Opportunity.Tier__c, "1"), 1 ,
    IF(ISPICKVAL(Opportunity.Tier__c, "2"), 2,
        IF(ISPICKVAL(Opportunity.Tier__c, "3")), 3,
        ... ),
0)

Another option in this type of scenario will be to use the CASE function

CASE(Opportunity.Tier__c,
    "1", 1,
    "2", 2,
    "3", 3,
     ...,
    0
)

Thanks,
Kaustav

All Answers

kaustav goswamikaustav goswami
You can go for a nested IF statement. The format will be something like this -

IF('CONDITION', TRUE VALUE, NEXT IF)

Example:

IF(ISPICKVAL(Opportunity.Tier__c, "1"), 1 ,
    IF(ISPICKVAL(Opportunity.Tier__c, "2"), 2,
        IF(ISPICKVAL(Opportunity.Tier__c, "3")), 3,
        ... ),
0)

Another option in this type of scenario will be to use the CASE function

CASE(Opportunity.Tier__c,
    "1", 1,
    "2", 2,
    "3", 3,
     ...,
    0
)

Thanks,
Kaustav
This was selected as the best answer
Phillip MoseleyPhillip Moseley
Kaustav, Thanks very much for the help. I used your second option below and it worked great. I will make note that this was the best answer. Phillip