counting characters within a cell

R

Rowland Long

Is there a way to count the occurrences of a certain character within a
cell?

For instance cell A1 contains 1-20/2-12/3-9
I need to find how many times '-' or '/' occurs in A1

thanks in advance,
Rowland
 
H

Harald Staff

Hi Rowland

The usual way is to compare the length of the text to the length of the text
where the character is removed. The difference equals the count of removed
characters.

=LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))

HTH. Best wishes Harald
 
Top