View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Marcelo Marcelo is offline
external usenet poster
 
Posts: 1,047
Default count number of appearences in cell

Hi Jack
use this code:
**********************************************
Function CountChar(MyChar, Mystring)
Dim counter As Integer

CountChar = 0

For counter = 1 To Len(Mystring)
If Mid(Mystring, counter, 2) = MyChar Then CountChar = CountChar + 1
Next counter

End Function
**********************************************
" If Mid(Mystring, counter, 2) " the 2 on this part of the code said how
many char you are looking for, if you need to count just 3's or a's change it
to 1

use a funcion =countchar("3a",a1)


hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Jack Sons" escreveu:

Hi all,

A certain character or group of characters appears a number of times in the
content of a cell (3a appears two times in d763ah555#3abds3j. With what
formula or code can I count that number? I think I knew it once, but I can't
remember.

Jack Sons
The Netherlands