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
Del_SantosDel_Santos 

IF and INCLUDES function on a Multi-Picklist field

Hi Everyone,

 

I am trying to create a formula using the IF and INCLUDES function out of the multi-picklist field. Here's the scenario:

I have a mutli-picklist Area__c with options as: Manila West, Manila Central, Pasay North. I want the result to return "Manila" if user picked any of these values.

 

Here's my formula, but when a user select all of the options it resulted to Manila;Manila;Manila.

How can make the ouput to single Manila only if user selected 2 or more options.

 

 

IF(INCLUDES(Areas__c,"Manila West"), "Manila;","") &
IF(INCLUDES(Areas__c,"Manila Central"), "Manila;","") &
IF(INCLUDES(Areas__c,"Pasay North"), "Manila;","")

 

Thanks,

Del

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

I need a pain relief after doing this, please try this one :

 

IF(INCLUDES(Areas__c,"Manila West"), "Manila;",IF(INCLUDES(Areas__c,"Manila Central"), "Manila;",IF(INCLUDES(Areas__c,"Pasay North"), "Manila;",""))) &
IF(INCLUDES(Areas__c,"Pasay South"), "South Metro;",IF(INCLUDES(Areas__c,"Makati West"), "South Metro;",IF(INCLUDES(Areas__c,"South Luzon SEZ"), "South Metro;",""))) &
IF(INCLUDES(Areas__c,"Baguio"), "Baguio;","") &
IF(INCLUDES(Areas__c,"Tuguegarao"), "Tuguegarao;","") &
IF(INCLUDES(Areas__c,"Quezon City"), "MPQ;",IF(INCLUDES(Areas__c,"Manda-Pasig North"), "MPQ;",IF(INCLUDES(Areas__c,"Manda-Pasig South"), "MPQ;",""))) &
IF(INCLUDES(Areas__c,"Makati East"), "Makati;",IF(INCLUDES(Areas__c,"Makati South Taguig"), "Makati;",""))&
IF(INCLUDES(Areas__c,"Cebu"), "Cebu;","") &
IF(INCLUDES(Areas__c,"Kalookan"), "Kalookan;",IF(INCLUDES(Areas__c,"Manila East"), "Kalookan;","")) &
IF(INCLUDES(Areas__c,"Inside Sales/Retail Retention"), "Inside Sales/Retail Retention;","")

 Hopefuly it will work.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Have you tried this :

 

IF(INCLUDES(Areas__c,"Manila West"), "Manila;","") ||
IF(INCLUDES(Areas__c,"Manila Central"), "Manila;","") ||
IF(INCLUDES(Areas__c,"Pasay North"), "Manila;","")

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Del_SantosDel_Santos

Hi Ankit_Arora,

 

Thanks, already tried that one and it's giving me this error.

 

Error: Incorrect parameter for function 'or()'. Expected Boolean, received Text

 

Regards,

Del

Ankit AroraAnkit Arora

Can you please show me the complete formual?

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Del_SantosDel_Santos

Hi Ankit,

 

Here's the complete formula and the results.

What i wanted is to eliminate the duplicate values in the result.

 

 

FORMULA:

IF(INCLUDES(Areas__c,"Manila West"), "Manila;","") &
IF(INCLUDES(Areas__c,"Manila Central"), "Manila;","") &
IF(INCLUDES(Areas__c,"Pasay North"), "Manila;","") &
IF(INCLUDES(Areas__c,"Pasay South"), "South Metro;","") &
IF(INCLUDES(Areas__c,"Makati West"), "South Metro;","") &
IF(INCLUDES(Areas__c,"South Luzon SEZ"), "South Metro;","") &
IF(INCLUDES(Areas__c,"Baguio"), "Baguio;","") &
IF(INCLUDES(Areas__c,"Tuguegarao"), "Tuguegarao;","") &
IF(INCLUDES(Areas__c,"Quezon City"), "MPQ;","") &
IF(INCLUDES(Areas__c,"Manda-Pasig North"), "MPQ;","") &
IF(INCLUDES(Areas__c,"Manda-Pasig South"), "MPQ;","") &
IF(INCLUDES(Areas__c,"Makati East"), "Makati;","") &
IF(INCLUDES(Areas__c,"Makati South Taguig"), "Makati;","") &
IF(INCLUDES(Areas__c,"Cebu"), "Cebu;","") &
IF(INCLUDES(Areas__c,"Kalookan"), "Kalookan;","") &
IF(INCLUDES(Areas__c,"Manila East"), "Kalookan;","") &
IF(INCLUDES(Areas__c,"Inside Sales/Retail Retention"), "Inside Sales/Retail Retention;","")

 

RESULT:

Manila;Manila;Manila;South Metro;South Metro;South Metro;Baguio;Tuguegarao;MPQ;MPQ;MPQ;Makati;Cebu;Kalookan;Kalookan;Inside Sales/Retail Retention;

Del_SantosDel_Santos

Also, Is there a way I can hide specific values to specific user?

Ankit AroraAnkit Arora

I need a pain relief after doing this, please try this one :

 

IF(INCLUDES(Areas__c,"Manila West"), "Manila;",IF(INCLUDES(Areas__c,"Manila Central"), "Manila;",IF(INCLUDES(Areas__c,"Pasay North"), "Manila;",""))) &
IF(INCLUDES(Areas__c,"Pasay South"), "South Metro;",IF(INCLUDES(Areas__c,"Makati West"), "South Metro;",IF(INCLUDES(Areas__c,"South Luzon SEZ"), "South Metro;",""))) &
IF(INCLUDES(Areas__c,"Baguio"), "Baguio;","") &
IF(INCLUDES(Areas__c,"Tuguegarao"), "Tuguegarao;","") &
IF(INCLUDES(Areas__c,"Quezon City"), "MPQ;",IF(INCLUDES(Areas__c,"Manda-Pasig North"), "MPQ;",IF(INCLUDES(Areas__c,"Manda-Pasig South"), "MPQ;",""))) &
IF(INCLUDES(Areas__c,"Makati East"), "Makati;",IF(INCLUDES(Areas__c,"Makati South Taguig"), "Makati;",""))&
IF(INCLUDES(Areas__c,"Cebu"), "Cebu;","") &
IF(INCLUDES(Areas__c,"Kalookan"), "Kalookan;",IF(INCLUDES(Areas__c,"Manila East"), "Kalookan;","")) &
IF(INCLUDES(Areas__c,"Inside Sales/Retail Retention"), "Inside Sales/Retail Retention;","")

 Hopefuly it will work.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
Del_SantosDel_Santos

weee. you got it Ankit. I owe you one. Thank you very much..:))

Ankit AroraAnkit Arora

That's awesome!! Nice to hear that and yeah you owe me ??? Beer or Coffee ???

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Madhura BMadhura B

Hi Ankit,

 

Any idea how to use the same on VF to render an outputpanel please?