0
Thanks

A few words of thanks would be greatly appreciated.

Excel - How to count a letter's occurences within a Cell




Issue


Can you please let me know if there is a way where a particular text string can be counted within a value of a cell itself.

For example: A cell contains AAAABBBCCCAAA and I need to calculate occurrences of alphabet 'A' in this particular cell.

Solution


This should do the trick:

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


To find alphabet "B" or any other character, replace the "A" with the appropriate letter, or reference it to another cell where you can store the letter you are looking for, e.g.

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


where B1 now contains "A", or "C", etc.

Note


Thanks to WRL for this tip on the forum.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team

Published by . Latest update on by aakai1056.

This document, titled "Excel - How to count a letter's occurences within a Cell," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments