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
kbentleykbentley 

Formula that calculates # of items selected in a multiselect picklist field on the same record

Does anyone know if  a formula that will calculate the number of items selected on a multiselect picklist field?  Example If the the multiselect field was: What are your favorite pizza toppings? And the user selects Cheese, Mushrooms and Sausage from the 45 options on the multiselect picklist.  What would the formula be for the formula field to calculate the number 3 since 3 items were selected?

apex whistlerapex whistler

Your best bet is to use triggers for easy and simplicty. However, if you really want to do it via formula here is a way to accomplish it. You'll probably run into the formula character limitation first, especially if you have 45 options. Also, maintenance of formula will be challenging, especially when change the multi-select options.

 

 

IF(INCLUDES( MultiPickListField__c, 'ValueA'),1,0) + IF(INCLUDES( MultiPickListField__c, 'ValueB'),1,0) + IF(INCLUDES( MultiPickListField__c, 'ValueA'),1,0) + ....

 String each multi-select value into a IF function with 1 for TRUE and 0 for FALSE and add up all the IF functions. I haven't test the formula.