Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gabriel
 
Posts: n/a
Default count number of occurences within a string

Hello,

I want to count the number of "-" within a string like for instance
"abc-klm-xyz". There are two "-" characters. Is must be a function
that I don't know of.

Any suggestions?
Thanks in advance
Gabriel
  #2   Report Post  
Domenic
 
Posts: n/a
Default


=SUMPRODUCT(--(ISNUMBER(SEARCH("-",MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))))

Hope this helps!

Gabriel Wrote:
Hello,

I want to count the number of "-" within a string like for instance
"abc-klm-xyz". There are two "-" characters. Is must be a function
that I don't know of.

Any suggestions?
Thanks in advance
Gabriel



--
Domenic
------------------------------------------------------------------------
Domenic's Profile: http://www.excelforum.com/member.php...o&userid=10785
View this thread: http://www.excelforum.com/showthread...hreadid=320408

  #3   Report Post  
Domenic
 
Posts: n/a
Default


Domenic Wrote:
=SUMPRODUCT(--(ISNUMBER(SEARCH("-",MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))))

Hope this helps!


Or the much simpler...

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


--
Domenic
------------------------------------------------------------------------
Domenic's Profile: http://www.excelforum.com/member.php...o&userid=10785
View this thread: http://www.excelforum.com/showthread...hreadid=320408

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 the number of worksheets in a workbook Vincdc Excel Discussion (Misc queries) 7 January 17th 05 11:57 PM
Count number of shaded cells Maddoktor Excel Discussion (Misc queries) 2 December 20th 04 08:35 PM
Count the number of words in a cell! Doom3 Excel Worksheet Functions 4 November 23rd 04 06:00 AM
Count occurences between dates DJ Dusty Excel Worksheet Functions 3 November 11th 04 12:25 AM
how to count the nr of occurrences of a text string in a cell rang eagerbuyer Excel Worksheet Functions 1 November 4th 04 12:27 PM


All times are GMT +1. The time now is 01:02 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"