Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default How to concatenate a column into one cell? tia sal2

Greets all I'm trying to concatenate a column into one cell. Is thier
a way to have concatenate work on a range of cells in a column or a row.

Example: I have Column C2..C45 and I want to have all those
numbers/letters joined in on cell togather on F2.

Tia
SAL2
  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default How to concatenate a column into one cell? tia sal2

You could do it with a user defined function (UDF) like this:

Function join(my_range As Range) As String
join = ""
For Each my_cell In my_range
join = join & my_cell.Value
Next my_cell
End Function

Use this formula in cell F2:

=join(C2:C45)

Hope this helps.

Pete

wrote:

Greets all I'm trying to concatenate a column into one cell. Is thier
a way to have concatenate work on a range of cells in a column or a row.

Example: I have Column C2..C45 and I want to have all those
numbers/letters joined in on cell togather on F2.

Tia
SAL2


  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default How to concatenate a column into one cell? tia sal2

The easiest would be to use a User Defined Function or a macro.

Here's a UDF

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

=ConCatRange(C2:C45) enetered in F2

Returns a comma de-limited list.

Change the cell.text & "," to " " for a space or "" for no space.

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the above code in there. Save the
workbook and hit ALT + Q to return to Excel window.

Enter the formula as shown above.


Gord Dibben Excel MVP


On Fri, 12 Jan 2007 21:26:39 GMT, " wrote:

Greets all I'm trying to concatenate a column into one cell. Is thier
a way to have concatenate work on a range of cells in a column or a row.

Example: I have Column C2..C45 and I want to have all those
numbers/letters joined in on cell togather on F2.

Tia
SAL2


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
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Positioning Numeric Values Resulting from 6 Column Array Formula Sam via OfficeKB.com Excel Worksheet Functions 2 January 5th 06 02:03 AM
creating a bar graph Johnfli Excel Discussion (Misc queries) 0 October 26th 05 08:16 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM


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