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
David Huang 34David Huang 34 

formula for multiple picklist

Hi there,
Hope anyone could help me.
I have 10 x pick list fields (just Yes or No)
I have another field called Score
what I want to achieve is:
when answer is Yes, get score 1
if answer is No, get score 0
for example, if there are 4 x Yes, then the Score field will show 4
How to make it happen, cheers


David
Best Answer chosen by David Huang 34
Sai PraveenSai Praveen (Salesforce Developers) 
Hi David,

You can write the formula as below with return type as Number.
 
CASE(TEXT( Picklist1__c ),
"YES",1,
0) +
CASE(Text( Picklist2__c ),
"YES",1,
0)+ CASE(TEXT( Picklist3__c ),
"YES",1,
0)

If this solution helps, Please mark it as best answer.

Thanks,
​​​​​​​

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi David,

You can write the formula as below with return type as Number.
 
CASE(TEXT( Picklist1__c ),
"YES",1,
0) +
CASE(Text( Picklist2__c ),
"YES",1,
0)+ CASE(TEXT( Picklist3__c ),
"YES",1,
0)

If this solution helps, Please mark it as best answer.

Thanks,
​​​​​​​
This was selected as the best answer
David Huang 34David Huang 34
Hi Sai, Thanks for your help, it works, thanks again 😊 David
David Huang 34David Huang 34
Hi Sai, just one more question if you dont mind
If I have a multi-selected picklist.

for example

You preferred system:
Windows7,
Windows8,
Windows 10,
Windows 11

select: windows 7 -score 0, windows 8-score 1, windwos 10-score1; windows 11-score1

so if I choose Windows 7 and 8, the score is 1
choose windows 7,8&10, score is 2

thanks

David
David Huang 34David Huang 34
Hi Sai, if it is too hard, can we try
if any of them are selected, return 1, if none, return 0, thanks
Sai PraveenSai Praveen (Salesforce Developers) 
Hi David,

Can you try as below.
 
IF(INCLUDES( Features_Contracted__c , 'Windows7'), 0, 0) +
IF(INCLUDES(Features_Contracted__c, 'Windows8'), 1, 0) +
IF(INCLUDES(Features_Contracted__c, 'Windows 10'), 1, 0) +
IF(INCLUDES(Features_Contracted__c, 'Windows 11'), 1, 0)

Thanks,
​​​​​​​
David Huang 34David Huang 34
Thanks Sai, you are a true formula wizard, thanks for all your help, cheers David