Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RaY RaY is offline
external usenet poster
 
Posts: 164
Default re-occuring text 99

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)



--
Ray
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default re-occuring text 99

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

--
HTH

Bob Phillips

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

"Ray" wrote in message
...
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)



--
Ray



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default re-occuring text 99

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)

"Ray" wrote in message
...
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)



--
Ray



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
2nd most frequently occuring value Singh Excel Discussion (Misc queries) 3 March 2nd 09 11:35 PM
run programme error occuring harry buggy Excel Worksheet Functions 2 September 11th 07 12:18 PM
Custom function to search a string of text for certain values occuring within it MikeCM Excel Programming 21 October 11th 06 05:03 PM
Extracting the most frequently occuring text from a range Phil Excel Worksheet Functions 5 June 9th 06 01:39 PM
Re-occuring Inspection Dates Belarny Mic Excel Worksheet Functions 2 August 3rd 05 11:10 PM


All times are GMT +1. The time now is 08:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"