Tuesday, April 19, 2011

yogi_Count The Number Of Times A Letter Appears In A Range Of Cells

Yogi Anand, D.Eng, P.E.                                         Google Spreadsheet                            www.energyefficientbuild.com

jgicking said:
This is probably a simple answer but here we go...I am trying to count the number of times a letter occurs in a column on a spreadsheet.  
I have tried using the countif function but continue to get errors - either unknown name range errors, circular dependency errors or parse errors.
Ex:  
In the column B4 through B57 I wish to know how many times the letter S occurs.
-----------------------------------------------

Well, the case of a discreet letter (a single letter by itself) is easily handled by using the COUNTIF function ...
=countif(B4:B9,"S")
However, in the following solution I am going to take the case of computing how many times a letter, say S occurs in words or phrases in the range of interest B4:B9
And then of course I can extend this formulation to count the number of times any letter, S, or a, or p, or w, or p occur in the range of interest


1 comment:

  1. Thanks to suggestion by Andre (ahab), I have added Sheet2_AlternateSolution -- this enhanced solution can also consider a combination of contiguous letter or a phrase in contrast to just a single letter.

    ReplyDelete