8

I have a cell with some text content. For example: "Red, shirt, size," I need to count how many times the comma is used in this cell. The result should be "3"

Any ideas?

SiteRefresh
  • 83
  • 1
  • 3

2 Answers2

8

You can use the following formula: LEN(Cell)-LEN(SUBSTITUTE(Cell;"YourCharacter";""))

In your case, the formula would be: LEN(Cell)-LEN(SUBSTITUTE(Cell;",";""). LEN(Cell) does the following: Counts the number of characters in your cell. LEN(SUBSTITUTE(Cell;"YourCharacter";"")) counts the number of characters in your cell without the character ",". By subtracting the second formula, you get the number of occurrences of your character.

CristinaP
  • 316
  • 3
  • 6
3

You can use LEN() function as below

=LEN(cell)-LEN(SUBSTITUTE(cell;",";""))
Zaheer Khorajiya
  • 466
  • 3
  • 11