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
justin-SDjustin-SD 

Formula Field Text or Number IF INCLUDES syntax error on Multi Select

Hey,

I have a formula field, either text or number, that I want to use an IF CONTAINS formula on a multi select picklist. Ideally there would be several of these so I can get different outcomes similar to a case statement, but just the basic formula is giving me an error when I Check Syntax:

 

'Error: Syntax error missing ')'

 

Hear is my initial formula:

 

IF(INCLUDES(Project_TYPE__c, "Equipment"), 1, 2)

 

I've also tried IF(INCLUDES(Project_TYPE__c, "Equipment"), "1", "2")

 

With the same error.

 

I verified the field is available in the Insert Field pop-up. I've seen other threads where they discuss doing this and nesting the formula to work through the values, but I'd like just to get this one line to work.

 

Thanks for any help!

Kent ManningKent Manning
Hi Justin,

I don't see any problems with your formula. Try doing some troubleshooting by breaking your formula a part. For example: just type INCLUDES (Project_TYPE__c, "Equipment"). check the syntax, and save this. Then look at that result on your page layout. If your are getting back True then you know that this part of the formula is working. The other thing to try is type IF( True, 1, 2) and save this. If you get back 1 then you know this is working. Then go back and put the two statements together.

Also, look closely at your edit window to make sure you don't have a ')' or '(' somewhere else in the window that is not in view.
AdrianCCAdrianCC

Hello,

 

Lets try it the other way around:

IF ( 
	CONTAINS("Equipment", TEXT(Project_TYPE__c)),
	1,
	2
)

 Thank you,

Adrian