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
JaxBeachJaxBeach 

Need help with a picklist formula

Hi,

 

I have a formula part of is below and I get a picklist error message

 

IF(TEXT(CONTAINS("ME:NH:CT::VT:NY:MA:RI:NJ", Mailing State), "Northeastern", "Other"))

 

I thought the TEXT converted a picklist?

Best Answer chosen by Admin (Salesforce Developers) 
Jeff MayJeff May

TEXT converts a picklist. In your formula you are trying to get TEXT() to operate on a boolean (the result of CONTAINS).

 

you might try:

 

IF(CONTAINS("ME:NH:CT::VT:NY:MA:RI:NJ", TEXT(Mailing State)), "Northeastern", "Other"))

All Answers

harsha__charsha__c

Can you detail your scenario here.

 

 

Jeff MayJeff May

TEXT converts a picklist. In your formula you are trying to get TEXT() to operate on a boolean (the result of CONTAINS).

 

you might try:

 

IF(CONTAINS("ME:NH:CT::VT:NY:MA:RI:NJ", TEXT(Mailing State)), "Northeastern", "Other"))

This was selected as the best answer
JaxBeachJaxBeach

sure, sorry about that.  We have distributors that have many stores and we keep their addresses in a locations tab.  Depending on the state field (which is a picklist) I want to assign a marketing territory to each location.

 

For Example - a store location that would be in Maine (ME) would be assigned Northeastern as the Marketing Territory. So I want to say that if the state picklist field contains and then list out the states, return a result of ...Territory.

 

IF(TEXT(CONTAINS("ME:NH:CT:VT:NY:MA:RI:NJ:VA:WV:OH",  State_Province__c), "Northeastern",
IF(TEXT(CONTAINS("FL:NC:SC:LA:GA:AL:MS",  State_Province__c ), "Southeastern",
IF(TEXT(CONTAINS("AR:IL:IN:KS:MO:OK:KY:TN",  State_Province__c), "Central",
IF(TEXT(CONTAINS("NE:ND:SD:IA:WI:MN:MT:CO:UT:WY:ID:CO:AZ:TX:NM",  State_Province__c), "North Central",
IF(TEXT(CONTAINS("WA:OR:CA:NV:HI:AK",  State_Province__c), "Western", ""))))))))))

 

I get the error:  Error: Field State_Province__c is a picklist field. Picklist fields are only supported in certain functions

 

Thanks.

JaxBeachJaxBeach

Thanks!  That worked - looked like I had TEXT in the wrong spot.  Thanks so much :-)