ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using the Countif option (https://www.excelbanter.com/excel-discussion-misc-queries/247670-re-using-countif-option.html)

Gord Dibben

Using the Countif option
 
=COUNTIF(A1:A100,"a") if nothing else in the cell.

Are these letters part of strings within cells?

A1 = aardvark would have 3 "a"'s but =COUNTIF(A1,"a") would return 0

Try this UDF

Function CountChar(InRange As Range, Letter As String) As Long
Dim rng As Range
For Each rng In InRange
CountChar = CountChar + Len(rng.text) - _
Len(Application.WorksheetFunction.Substitute(UCase (rng.text) _
, UCase(Letter), ""))
Next rng
End Function

=CountChar(A1:A100,"a")


Gord Dibben MS Excel MVP

On Thu, 5 Nov 2009 10:50:01 -0800, mlkkrs
wrote:

I'm attempting to count how many a's, b's, c's, d's, etc are in a column. How
do I get started doing this? Any help is well appreciated.

Thank you




All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com