Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
mickbarry
 
Posts: n/a
Default Count function required


Hi all,
Just wondering if there is a function which will count the number of
occurences of a character within a cell.
eg A1 contains "x-ab-c"
I want to know the number of hyphens in that cell (answer 2)

Has anyone come up against this one before?

Regards Mick Barry
Sydney
You don't need a parachute to skydive,
You only need a parachute to skydive twice...


--
mickbarry
------------------------------------------------------------------------
mickbarry's Profile: http://www.excelforum.com/member.php...o&userid=31028
View this thread: http://www.excelforum.com/showthread...hreadid=510869

  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson
 
Posts: n/a
Default Count function required

Try a formula like the following

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


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



"mickbarry"
wrote in
message
...

Hi all,
Just wondering if there is a function which will count the
number of
occurences of a character within a cell.
eg A1 contains "x-ab-c"
I want to know the number of hyphens in that cell (answer 2)

Has anyone come up against this one before?

Regards Mick Barry
Sydney
You don't need a parachute to skydive,
You only need a parachute to skydive twice...


--
mickbarry
------------------------------------------------------------------------
mickbarry's Profile:
http://www.excelforum.com/member.php...o&userid=31028
View this thread:
http://www.excelforum.com/showthread...hreadid=510869



  #3   Report Post  
Posted to microsoft.public.excel.misc
mickbarry
 
Posts: n/a
Default Count function required


Chip,
Very clever.
I did think that the Substitute would go close due to its ability to
look past the first occurrence.
However I was just not smart enough to come up with the answer.
Well done

Regards Mick Barry
If you give a man a match, he will be warm for a moment, but if you
light a man on fire, he will be warm for the rest of his life!


--
mickbarry
------------------------------------------------------------------------
mickbarry's Profile: http://www.excelforum.com/member.php...o&userid=31028
View this thread: http://www.excelforum.com/showthread...hreadid=510869

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 function not working, keeps displaying 0 dnm Excel Worksheet Functions 5 April 3rd 23 07:32 PM
Function to count unique values? Richard Buttrey Excel Worksheet Functions 5 September 22nd 05 02:58 PM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
Count If Function Michele Excel Worksheet Functions 3 April 25th 05 02:31 PM
count if function with if statements Natalia Excel Worksheet Functions 3 April 22nd 05 02:52 AM


All times are GMT +1. The time now is 01:29 AM.

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"