re-occuring text 99

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)
 
B

Bob Phillips

=LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"t",""))

--
HTH

Bob Phillips

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

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top