Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I want to be able to count the number of times a letter is used in a cell.
For example, if cell A2 contains the string "radar" I want to be able to have excel return the number of times the letter "a" is used (2). |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
use this code: Press ALT+F11 copy and paste there use =countchar("a";a1) __________________________________________ Function CountChar(MyChar, Mystring) Dim counter As Integer CountChar = 0 For counter = 1 To Len(Mystring) If Mid(Mystring, counter, 1) = MyChar Then CountChar = CountChar + 1 Next counter End Function _____________________________________ hope this helps regards from Brazil Marcelo "jsrawlings" escreveu: I want to be able to count the number of times a letter is used in a cell. For example, if cell A2 contains the string "radar" I want to be able to have excel return the number of times the letter "a" is used (2). |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() =LEN(A1)-LEN(SUBSTITUTE(A1,"a","")) -- Bearacade ------------------------------------------------------------------------ Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016 View this thread: http://www.excelforum.com/showthread...hreadid=556259 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Since SUBSTITUTE is case sensitive, you might also consider:
=LEN(D23)-LEN(SUBSTITUTE(SUBSTITUTE(D23,"A",""),"a","")) This will count both "A" and "a" HTH, Elkar "Bearacade" wrote: =LEN(A1)-LEN(SUBSTITUTE(A1,"a","")) -- Bearacade ------------------------------------------------------------------------ Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016 View this thread: http://www.excelforum.com/showthread...hreadid=556259 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Or just:
=LEN(D23)-LEN(SUBSTITUTE(Upper(D23),"A","")) Elkar wrote: Since SUBSTITUTE is case sensitive, you might also consider: =LEN(D23)-LEN(SUBSTITUTE(SUBSTITUTE(D23,"A",""),"a","")) This will count both "A" and "a" HTH, Elkar "Bearacade" wrote: =LEN(A1)-LEN(SUBSTITUTE(A1,"a","")) -- Bearacade ------------------------------------------------------------------------ Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016 View this thread: http://www.excelforum.com/showthread...hreadid=556259 -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
So will this:
=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),"A","")) -- Regards, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "Elkar" wrote in message ... Since SUBSTITUTE is case sensitive, you might also consider: =LEN(D23)-LEN(SUBSTITUTE(SUBSTITUTE(D23,"A",""),"a","")) This will count both "A" and "a" HTH, Elkar "Bearacade" wrote: =LEN(A1)-LEN(SUBSTITUTE(A1,"a","")) -- Bearacade ------------------------------------------------------------------------ Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016 View this thread: http://www.excelforum.com/showthread...hreadid=556259 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count number of uniques starting with a given letter? | Excel Discussion (Misc queries) | |||
Return SEARCHED Column Number of Numeric Label and Value | Excel Worksheet Functions | |||
count the number of times the same number shown | Excel Discussion (Misc queries) | |||
Count number of cells that contain a certain letter - Case Sensitive | Excel Discussion (Misc queries) | |||
How do I get a letter in one cell ito equal a number in anotherl.. | Excel Discussion (Misc queries) |