SUBSTITUTE removes the substring from the original text and LEN calculates the length of the text without the substring.

This number is then subtracted from the length of the original text.

The result is the number of characters that were removed by SUBSTITUTE.

Excel formula: Count specific characters in text string

Finally, the number of characters removed is divided by the length of the substring.

Handling case

SUBSTITUTE is a case-sensitive function, so it will match case when running a substitution.

Normalizing text

Counting words in Excel is tricky because Excel doesn’t support regular expressions.

Excel formula: Count specific words in a range

find “fox " but not “foxes”).

Punctuation and case variations make this problem quite challenging.

One workaround is to useanother formulain ahelper columnto “normalize text” as a first step.

Excel formula: Count specific characters in a range

you could look for " fox " in the normalized text.

LEN will also count characters in numbers, but number formatting is not included.

SUBSTITUTE Function

The Excel SUBSTITUTE function replaces text in a given string by matching.

Excel formula: Cell contains one of many things

Numbers, punctuation, and spaces are not affected.

Excel LEN function

Excel SUBSTITUTE function

Excel UPPER function