Count specific characters in a cell

An excel formula to count specific characters in a cell

Related Functions

Sponsored Link

 Count specific characters in a cell

To count how many times a specific character appears in a cell, you use a formula based on the SUBSTITUTE and LEN functions. In the generic form of the formula above, a1 represents the cell address, and txt represents the character(s) that you want to count.

In the example, the active cell contains this formula:


How this formula works

This formula works by using SUBSTITUTE to first remove all of the characters being counted in the source text. Then the length of the text (with the character removed) is subtracted from the length of the original text. The result is the number of characters that were removed with SUBSTITUTE, which is equal to the count of those characters.

Upper and lower case

SUBSTITUTE is a case sensitive function, so it will match case when running a substitution. If you need to count both upper and lower case occurrences of a specific character, use the UPPER function inside SUBSTITUTE to convert the text to uppercase before running the substitution. Then supply an uppercase character as the text that's being substituted.


Sponsored Link

0 votes. 0 / 5