Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 1
Default How do I add a comma between a range of cells?

Example: I have cells A1 through A70 with data in each cell in the following
format 123-03-123. I need a sting of text returned that will combine the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in Excel :(

Thanks for all your help...

Chris
  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 22,906
Default How do I add a comma between a range of cells?


With 70 cells I would use a user defined function.

Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sbuf As String
For Each cell In CellBlock
If Len(cell.text) 0 Then sbuf = sbuf & cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

After concatenating the range using =ConCatRange(A1:A70)

copy/paste specialvalues.


Gord Dibben MS Excel MVP

On Tue, 19 Jun 2007 15:03:41 -0700, AZ ChrisD <AZ
wrote:

Example: I have cells A1 through A70 with data in each cell in the following
format 123-03-123. I need a sting of text returned that will combine the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in Excel :(

Thanks for all your help...

Chris


  #4   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 2,886
Default How do I add a comma between a range of cells?

Ignore that.
I totally misread your question.

--
Regards

Roger Govier


"Roger Govier" wrote in message
...
Hi

assuming the concatenated string is in A1
=SUBSTITUTE(A1,"-",",")


--
Regards

Roger Govier


"AZ ChrisD" <AZ wrote in message
...
Example: I have cells A1 through A70 with data in each cell in the
following
format 123-03-123. I need a sting of text returned that will combine
the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in
Excel :(

Thanks for all your help...

Chris





  #5   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 1
Default How do I add a comma between a range of cells?

That did it...

Thanks a bunch

"Gord Dibben" wrote:


With 70 cells I would use a user defined function.

Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sbuf As String
For Each cell In CellBlock
If Len(cell.text) 0 Then sbuf = sbuf & cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

After concatenating the range using =ConCatRange(A1:A70)

copy/paste specialvalues.


Gord Dibben MS Excel MVP

On Tue, 19 Jun 2007 15:03:41 -0700, AZ ChrisD <AZ
wrote:

Example: I have cells A1 through A70 with data in each cell in the following
format 123-03-123. I need a sting of text returned that will combine the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in Excel :(

Thanks for all your help...

Chris





  #6   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 22,906
Default How do I add a comma between a range of cells?

Good to hear.

Thanks for the feedback.

On Wed, 20 Jun 2007 09:45:02 -0700, AZ ChrisD
wrote:

That did it...

Thanks a bunch

"Gord Dibben" wrote:


With 70 cells I would use a user defined function.

Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sbuf As String
For Each cell In CellBlock
If Len(cell.text) 0 Then sbuf = sbuf & cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

After concatenating the range using =ConCatRange(A1:A70)

copy/paste specialvalues.


Gord Dibben MS Excel MVP

On Tue, 19 Jun 2007 15:03:41 -0700, AZ ChrisD <AZ
wrote:

Example: I have cells A1 through A70 with data in each cell in the following
format 123-03-123. I need a sting of text returned that will combine the
cells separated by a comma.

Example: 123-34-234,234-23-234,345-23-123, etc...

I need to be able to copy and paste the string in to a websearch that
specifies "separated by commas no spaces"

I know there has to be a simple way to do that but I am a rookie in Excel :(

Thanks for all your help...

Chris




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 delete text to right of a comma in a range of cells? Mike M. Excel Discussion (Misc queries) 2 January 14th 06 06:24 PM
need to remove a comma from end of test in cells Jerry Kinder Excel Worksheet Functions 4 December 14th 05 01:25 AM
Put all cells in one cell seperated by comma kokopoko New Users to Excel 6 August 6th 05 03:03 AM
Extract comma broken address to cells bbc1 Excel Discussion (Misc queries) 5 February 14th 05 11:21 AM
How do i merge data in a row of cells to be comma separated in on. Banana Excel Discussion (Misc queries) 1 February 7th 05 05:42 PM


All times are GMT +1. The time now is 09:06 PM.

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"