[SalesForce] How to count the commas in text field

I want a formula field that should contain the count based on commas (',')

Example:

if if text filed contains value1,value2 then count should be 1

if if text filed contains value1,value2,value3 then count should be 2

I am unable to get this formula field. Please help me how can i achieve this formula field.

Best Answer

LEN(Text_Field__c ) - LEN( SUBSTITUTE(Text_Field__c , ',', '') )
Related Topic