PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Discussion counting commas within a string

Reply

counting commas within a string

 
Thread Tools Rate Thread
Old 08-07-2008, 10:20 PM   #1
Ron.Winkley@gmail.com
Guest
 
Posts: n/a
Default counting commas within a string


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
Old 08-07-2008, 10:38 PM   #2
Harald Staff
Guest
 
Posts: n/a
Default Re: counting commas within a string

Hi RonW

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

HTH. Best wishes Harald

<Ron.Winkley@gmail.com> skrev i melding
news:4efd29cb-6978-4e8c-80ef-fbfd6f1c7d9d@y21g2000hsf.googlegroups.com...
> 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
Old 09-07-2008, 01:57 AM   #3
Gary''s Student
Guest
 
Posts: n/a
Default RE: counting commas within a string

=LEN(E2)-LEN(SUBSTITUTE(E2,",",""))+1
with your data in E2
--
Gary''s Student - gsnu2007j


"Ron.Winkley@gmail.com" 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
Old 09-07-2008, 02:12 AM   #4
Dave Peterson
Guest
 
Posts: n/a
Default Re: counting commas within a string

If you want to count the number of "elements" that are separated by commas:

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



Ron.Winkley@gmail.com 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off