Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default count number of times a particular letter appears in a cell

Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?


Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default count number of times a particular letter appears in a cell


NumberOfEs = Len(Text) - Len(Replace(Text, "E", ""))


CE



fallowfz wrote:
Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?


Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default count number of times a particular letter appears in a cell

=len(a1)-len(substitute(upper(a1),"E",""))
will count the number of lower or upper case E's in A1.

=len(a1)-len(substitute(a1,"E",""))
will count the number of upper case E's in A1.

(=substitute() is case sensitive)


fallowfz wrote:

Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?

Thanks!


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default count number of times a particular letter appears in a cell

You can do it with a formula:

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

This is case sensitive. For case insensitive, use

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

In code, use

Dim S As String
Dim N As Long
S = Range("A1").Text
N = Len(S) - Len(Replace(S, "e", vbNullString))
Debug.Print N

This is case sensitive. For case insensitive, use

Dim S As String
Dim N As Long
S = Range("A1").Text
N = Len(S) - Len(Replace(UCase(S), "E", vbNullString))
Debug.Print N

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Mon, 24 Nov 2008 10:51:43 -0800 (PST), fallowfz
wrote:

Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?


Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default count number of times a particular letter appears in a cell

Hi,

Try this case sensitive idea

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

Mike

"fallowfz" wrote:

Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?


Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default count number of times a particular letter appears in a cell

On Nov 24, 2:12*pm, Mike H wrote:
Hi,

Try this case sensitive idea

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

Mike



"fallowfz" wrote:
Is there a function which will return the number of times, for
example, the letter "E" appears in a cell containing a mix of text,
numbers, and other characters, e.g. (), :, etc?


Thanks!- Hide quoted text -


- Show quoted text -


WOW...thanks for the quick responses. All of them work great!
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
Excel= can I count how many times letter a appears in 1 cell? Jack D Excel Worksheet Functions 6 November 1st 07 03:18 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 06:45 PM.

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

About Us

"It's about Microsoft Excel"