PC Review


Reply
Thread Tools Rate Thread

counting commas within a string

 
 
Ron.Winkley@gmail.com
Guest
Posts: n/a
 
      8th Jul 2008
Hi to All,

Cell A1 contains a text string such as 56,58,12,1,22,893
I want to determine how many numbers are contained within the string
Simply, counting the commas and adding 1 one seems to be the easy
answer
How can I create an Excel formula to count the commas, or please
suggest
an alternative method.

Thanks for your help,

Cheers,
RonW
 
Reply With Quote
 
 
 
 
Harald Staff
Guest
Posts: n/a
 
      8th Jul 2008
Hi RonW

Length of string minus length of sting without commas:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

HTH. Best wishes Harald

<(E-Mail Removed)> skrev i melding
news:4efd29cb-6978-4e8c-80ef-(E-Mail Removed)...
> Hi to All,
>
> Cell A1 contains a text string such as 56,58,12,1,22,893
> I want to determine how many numbers are contained within the string
> Simply, counting the commas and adding 1 one seems to be the easy
> answer
> How can I create an Excel formula to count the commas, or please
> suggest
> an alternative method.
>
> Thanks for your help,
>
> Cheers,
> RonW



 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      9th Jul 2008
=LEN(E2)-LEN(SUBSTITUTE(E2,",",""))+1
with your data in E2
--
Gary''s Student - gsnu2007j


"(E-Mail Removed)" wrote:

> Hi to All,
>
> Cell A1 contains a text string such as 56,58,12,1,22,893
> I want to determine how many numbers are contained within the string
> Simply, counting the commas and adding 1 one seems to be the easy
> answer
> How can I create an Excel formula to count the commas, or please
> suggest
> an alternative method.
>
> Thanks for your help,
>
> Cheers,
> RonW
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th Jul 2008
If you want to count the number of "elements" that are separated by commas:

=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+(A1<>"")



(E-Mail Removed) wrote:
>
> Hi to All,
>
> Cell A1 contains a text string such as 56,58,12,1,22,893
> I want to determine how many numbers are contained within the string
> Simply, counting the commas and adding 1 one seems to be the easy
> answer
> How can I create an Excel formula to count the commas, or please
> suggest
> an alternative method.
>
> Thanks for your help,
>
> Cheers,
> RonW


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting the number of commas within a text string Ron.Winkley@gmail.com Microsoft Excel Discussion 2 10th Jul 2008 09:13 PM
counting commas within a string Ron.Winkley@gmail.com Microsoft Excel Discussion 1 9th Jul 2008 12:15 AM
Counting Unique Values That Are Separate by Commas in a Column Rothman Microsoft Excel Misc 2 25th Mar 2008 09:06 PM
Re: Code for counting commas in a text field? Katrina Microsoft Access VBA Modules 2 16th Jun 2004 11:12 PM
Code for counting commas in a text field? Chris Nebinger Microsoft Access VBA Modules 2 15th Jun 2004 08:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:26 PM.