re-occuring text 99

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know of a function in VBA that counts number of time text
re-occurs in a string.

ie Test String ... T appears 3 times.

I wrote a function that does a character by character check but its very
slow when checking large amounts of data.

Thank you (if this post appears twice its because my comp keeps bombing)
 
=LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"t",""))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
if you want VBA

Function CountOccurances(val As String, check As String)
CountOccurances = Len(val) - _
Len(Replace(LCase(val), LCase(check), ""))
End Function


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Back
Top