Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default Count Commas in Cells

I'm looking for a formula that will count commas or count items deliniated by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default Count Commas in Cells

Try something like this:

With
A1: (containing a comma delimited list)

This formula counts the commas:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

and...this one counts the items
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Dax Arroway" wrote:

I'm looking for a formula that will count commas or count items deliniated by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Count Commas in Cells

This formula will give you the number of commas in a cell:

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

And for counting items, just add 1 to the above formula.

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

HTH,
Elkar


"Dax Arroway" wrote:

I'm looking for a formula that will count commas or count items deliniated by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Count Commas in Cells

Try this to obtain the count of elements in a cell:

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

Copy down as needed.

Biff

"Dax Arroway" wrote in message
...
I'm looking for a formula that will count commas or count items deliniated
by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to
indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 70
Default Count Commas in Cells

You guys are awesome! Thanks so much!

"Ron Coderre" wrote:

Try something like this:

With
A1: (containing a comma delimited list)

This formula counts the commas:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

and...this one counts the items
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Dax Arroway" wrote:

I'm looking for a formula that will count commas or count items deliniated by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default Count Commas in Cells

You're very welcome....and thanks for the feedback.

***********
Regards,
Ron

XL2002, WinXP


"Dax Arroway" wrote:

You guys are awesome! Thanks so much!

"Ron Coderre" wrote:

Try something like this:

With
A1: (containing a comma delimited list)

This formula counts the commas:
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))

and...this one counts the items
=LEN(A1)-LEN(SUBSTITUTE(A1,",",""))+1

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"Dax Arroway" wrote:

I'm looking for a formula that will count commas or count items deliniated by
commas in cells. I've got table data in column A like:

A1=red, blue, green
A2=blue, Fred
A3=Can, jar, stack

And I need to count the elements in each cell. So, after the formula the
cells would list:
B1=2
B2=1
B3=2
(if counting commas) or:
3
2
3
(if counting items)

I then ultimately plan on running a piviot table off of Column B to indicate
by percent of the entries have 1, 2, 3, 4, etc. items listed in them.

Anyone got a way of doing that?

Thanks in advance for your help!
- Dax




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 do I count cells with text but ignore cells with spaces? Husker87 Excel Discussion (Misc queries) 2 September 21st 06 12:31 AM
Count Only Empty Cells AFTER Cells with Data David Excel Worksheet Functions 2 September 15th 06 06:05 PM
Can I count conditionally formatted red cells in Excel 2000 ExcelUser Excel Discussion (Misc queries) 1 August 2nd 06 03:40 PM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Can I count how many grey-filled cells are in a row ? AnthonyG Excel Worksheet Functions 1 February 4th 05 10:08 AM


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