Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 67
Default character count

I seem to have misplaced a function.


What is hte method for counting how many times a specific character occurs
inside a string without looping through it?
eg...

a = FUCNTIONCHARSEARCH("The quick brown fox ran over the yard.","t")
a = 2


?




--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default character count

=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))

or in VBA

Dim L As Long
Dim S As String
S = "abcda"
L = Len(S) - Len(Replace(S, "a", ""))
Debug.Print L


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"ben" (remove this if mailing direct)
wrote in message
...
I seem to have misplaced a function.


What is hte method for counting how many times a specific
character occurs
inside a string without looping through it?
eg...

a = FUCNTIONCHARSEARCH("The quick brown fox ran over the
yard.","t")
a = 2


?




--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if
they aren''t
expected to go into the code?



  #3   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 67
Default character count

ah, brilliant

thank you

--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"Chip Pearson" wrote:

=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))

or in VBA

Dim L As Long
Dim S As String
S = "abcda"
L = Len(S) - Len(Replace(S, "a", ""))
Debug.Print L


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"ben" (remove this if mailing direct)
wrote in message
...
I seem to have misplaced a function.


What is hte method for counting how many times a specific
character occurs
inside a string without looping through it?
eg...

a = FUCNTIONCHARSEARCH("The quick brown fox ran over the
yard.","t")
a = 2


?




--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if
they aren''t
expected to go into the code?




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
count a character hsg Excel Discussion (Misc queries) 2 December 4th 09 05:52 PM
Character count dan Excel Discussion (Misc queries) 9 September 27th 07 07:57 PM
character count Mariappan New Users to Excel 3 September 6th 07 02:18 PM
Character count and locking? Liani Excel Discussion (Misc queries) 2 April 20th 06 10:55 AM
Character Count Hardip Excel Worksheet Functions 5 January 10th 06 01:46 PM


All times are GMT +1. The time now is 04:00 AM.

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

About Us

"It's about Microsoft Excel"