Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Excel= can I count how many times letter a appears in 1 cell?

in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Excel= can I count how many times letter a appears in 1 cell?

=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))
--
David Biddulph

"Jack D" <Jack wrote in message
...
in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel= can I count how many times letter a appears in 1 cell?

You could employ a 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,"a") for one cell

=countchar(A1:A10,"a") for a range of cells.

If not familiar with macros and VBA, visit David McRitchie's website on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

And Ron de Bruin's site for where to place codes.

http://www.rondebruin.nl/code.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the above code in there. Save the
workbook and hit ALT + Q to return to your workbook.


Gord Dibben Excel MVP



On Wed, 31 Oct 2007 14:28:03 -0700, Jack D <Jack
wrote:

in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Excel= can I count how many times letter a appears in 1 cell?

It appears that the gentlemen who suggested using formulas, allowed the case
sensitivity of Substitute to slip their minds.<bg.

This will include the capital "A" at the beginning of the sentence in the
count:

=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER("a"),""))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Jack D" <Jack wrote in message
...
in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default Excel= can I count how many times letter a appears in 1 cell?

Really? You might want to look at my solution again RD
<LOWER("G")


--

Regards,

Peo Sjoblom




"Ragdyer" wrote in message
...
It appears that the gentlemen who suggested using formulas, allowed the
case
sensitivity of Substitute to slip their minds.<bg.

This will include the capital "A" at the beginning of the sentence in the
count:

=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER("a"),""))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Jack D" <Jack wrote in message
...
in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Excel= can I count how many times letter a appears in 1 cell?

Damn ... I must start reading entire posts! ! !

Just looked at the first formula and didn't even read your text, and simply
overlooked the second formula.

I'm very sorry Peo!

Don't have as much time to play around in here like I used to.
--

Regards,

RD
-----------------------------------------------------------------------------------------------
Please keep all correspondence within the Group, so all may benefit !
-----------------------------------------------------------------------------------------------

"Peo Sjoblom" wrote in message
...
Really? You might want to look at my solution again RD
<LOWER("G")


--

Regards,

Peo Sjoblom




"Ragdyer" wrote in message
...
It appears that the gentlemen who suggested using formulas, allowed the
case
sensitivity of Substitute to slip their minds.<bg.

This will include the capital "A" at the beginning of the sentence in the
count:

=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER("a"),""))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Jack D" <Jack wrote in message
...
in cell a1 is the following sentence - A cat ran up a tree. Is there a
formula to find how many times the letter "a" is in cell A1?





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
count how many times a date appears fyrefox Excel Discussion (Misc queries) 1 October 12th 07 04:00 PM
I WANT TO COUNT HOW MANY TIMES A CERTAIN LETTER APPEARS IN A ROW spring022377 Excel Worksheet Functions 13 February 16th 07 08:39 AM
How do I count the number of times a value appears? Christine Excel Worksheet Functions 2 February 8th 07 09:38 PM
How do I count the number of times a letter is used in a cell? jsrawlings Excel Discussion (Misc queries) 5 June 28th 06 02:02 AM
Count Number of Times Something appears Mark B Excel Worksheet Functions 5 November 29th 05 08:36 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"