Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting chars in a string

Hi,

I am writing some code to insert new records into an excel databas
where a key value has muliple values in the one record.

The separator is a comma.

Is there a way to count the number of comma's in a given string withou
having to write a new function???

Cheers,

b

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Counting chars in a string

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

bcmiller < wrote:
Hi,

I am writing some code to insert new records into an excel database
where a key value has muliple values in the one record.

The separator is a comma.

Is there a way to count the number of comma's in a given string without
having to write a new function???

Cheers,

bc


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting chars in a string

Thanks Yogendra,

I had written a for loop to do the job, but that was slowing my macr
down, your tip has cut the size of my code and its execution time.

Cheers,

B

--
Message posted from http://www.ExcelForum.com

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
How to truncate list of meaningful words greater than 15 chars tomeaningful words of 8 chars. Babloo Excel Worksheet Functions 4 April 29th 11 11:27 PM
Mind-numbing simple data validation ... string from 1 to 64 chars Will Finkle Excel Worksheet Functions 6 September 16th 07 03:10 PM
Counting Upper and Lower case chars in a Cell Mad Axeman Excel Discussion (Misc queries) 7 July 31st 07 05:31 PM
macro to bold number of chars from end of a string herbwarri0r Excel Discussion (Misc queries) 4 June 6th 06 01:21 PM
remove blanks from a string of chars within a cell? rayhollidge Excel Discussion (Misc queries) 3 January 8th 05 02:43 AM


All times are GMT +1. The time now is 05:34 PM.

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"