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


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.

LEN(Text_Field__c ) - LEN( SUBSTITUTE(Text_Field__c , ',', '') )
  • Hi Saumya, That's great. Its working But i have doubt, i tried upto 10 commas.... will it work for irrespective number of commas? – KS Kumaar Feb 14 '17 at 12:18
  • @KSKumaar, It would work. have you tried it? – Raul Feb 14 '17 at 12:52
  • @KSKumaar Yes, it will. – Saumya Ranjan Satapathy Feb 14 '17 at 13:06
  • Yes @Rahul Shrma, Its working – KS Kumaar Feb 14 '17 at 13:11
  • 1
    This answer would be better if you included a description of why this works. Code dumps without explanation won't really help people that view this answer unless they have the exact same problem to be solved. Simply providing the answer on a silver platter doesn't help the person who asked the question grow more independent as a programmer either. – Derek F Feb 14 '17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.