Print this page

How to count the number of values selected in multi-select picklist field

Knowledge Article Number 000221353
Description This Formula will help us to count the number of values selected in multi-select picklist

Use Case: 

An insurance company is selling various insurance packages:

Retirement insurance plan
Equity fund plan
Vehicle insurance plan
Mortgage based insurance plan etc.,

If a customer is interested in more than 3 product the company would like to send a senior consultant as the deal can be potentially higher

All these plans are stored as a Multi select picklist

Use Case is an example scenario where the formula can be applied but the requirement will vary depending on organization's need.
Resolution Below is the formula to calculate number of values selected in multi-select picklist


Navigate to the fields area of the appropriate object.
1.    For standard objects, from Setup, click Customize, select the appropriate object, and click Fields.
2.    For custom objects, from Setup, click Create | Objects, and select one of the custom objects in the list.
3.    In Custom Fields & Relationships, click New.
4.    Choose the Formula as the type and click Next
5.    Enter a field label(Salesforce populates Field Name using the field label)
6.    Select the Formula Return Type as Number
7.    Choose the number of decimal places as 0
8.    Select the Advanced Formula
9.    To insert a function, double-click its name in the list, or select it and click Insert Selected Function

                  IF(INCLUDES( Multi_Picklist_Field__c , "Value A"),1,0) +
                  IF(INCLUDES( Multi_Picklist_Field__c , "Value B"),1,0) +
                  IF(INCLUDES( Multi_Picklist_Field__c , "Value C"),1,0) +
                  IF(INCLUDES(  Multi_Picklist_Field__c , "Value D"),1,0)

10.  To check your formula for errors, click Check Syntax and Save.

Note: As the list is updated so does the formula need to be.

promote demote