Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
elicamacho
 
Posts: n/a
Default characters and strings

How can I count how many times a certain letter is used in a string? For
example, I would like to calculate how many times the letter "a" occors in
the word "alphabetical" and any other series of words. Is there a macro that
can be used to help this problem?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Niek Otten
 
Posts: n/a
Default characters and strings

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

--
Kind regards,

Niek Otten

"elicamacho" wrote in message ...
How can I count how many times a certain letter is used in a string? For
example, I would like to calculate how many times the letter "a" occors in
the word "alphabetical" and any other series of words. Is there a macro that
can be used to help this problem?



  #3   Report Post  
Posted to microsoft.public.excel.misc
David Billigmeier
 
Posts: n/a
Default characters and strings

Assume cell A1:
=SUMPRODUCT(--(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)="a"))


--
Regards,
Dave


"elicamacho" wrote:

How can I count how many times a certain letter is used in a string? For
example, I would like to calculate how many times the letter "a" occors in
the word "alphabetical" and any other series of words. Is there a macro that
can be used to help this problem?

  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default characters and strings

Try this:

For any text in A1 and the text to find in B1

C1: =LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER(B1),""))
returns the count of B1 in the text in A1

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"elicamacho" wrote:

How can I count how many times a certain letter is used in a string? For
example, I would like to calculate how many times the letter "a" occors in
the word "alphabetical" and any other series of words. Is there a macro that
can be used to help this problem?

  #5   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default characters and strings

If you are searching for a multi-letter string:

A1: (the text to be searched)
B1: (the string to find in A1)
C1: =(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER(B1),"")))/LEN(B1)

For
A1: alphabetical
B1: AL
C1: returns 2

***********
Regards,
Ron

XL2002, WinXP-Pro


"elicamacho" wrote:

How can I count how many times a certain letter is used in a string? For
example, I would like to calculate how many times the letter "a" occors in
the word "alphabetical" and any other series of words. Is there a macro that
can be used to help this problem?



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
hash function for large strings jheby Excel Worksheet Functions 22 March 16th 06 07:07 PM
VB Assigning Values to a Series of Strings cincode5 Excel Discussion (Misc queries) 1 August 4th 05 11:38 PM
Wildcard MATCH() breaks on long (?) strings [email protected] Excel Worksheet Functions 6 May 6th 05 02:11 AM
Writing Localized Strings In Cells Using Automation VirGin Excel Discussion (Misc queries) 0 March 7th 05 01:04 PM
How can I find strings of wildcards in Excel? Nick M Excel Discussion (Misc queries) 2 December 20th 04 05:59 PM


All times are GMT +1. The time now is 07:07 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"