1

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.

1 Answer 1

3
LEN(Text_Field__c ) - LEN( SUBSTITUTE(Text_Field__c , ',', '') )
6
  • 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, 2017 at 12:18
  • @KSKumaar, It would work. have you tried it?
    – Raul
    Feb 14, 2017 at 12:52
  • @KSKumaar Yes, it will. Feb 14, 2017 at 13:06
  • Yes @Rahul Shrma, Its working
    – KS Kumaar
    Feb 14, 2017 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, 2017 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .