#1   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Concatenate an array

Hello I guess it might not possible, but I have around 100 columns each with
a single character, I would like to concatenate those into a single cell, is
that possible in ANY way?

thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Concatenate an array

100 columns and how many rows?

This UDF will do the trick but after about 1024 characters in a cell you won't
see the text.

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 & ","
'remove the & "," if you don't want a comma
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

Usage is: =ConCatRange(A1:CV1)


Gord Dibben MS Excel MVP


On Sat, 1 Jul 2006 11:20:02 -0700, Ed wrote:

Hello I guess it might not possible, but I have around 100 columns each with
a single character, I would like to concatenate those into a single cell, is
that possible in ANY way?

thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Concatenate an array

On Sat, 1 Jul 2006 11:20:02 -0700, Ed wrote:

Hello I guess it might not possible, but I have around 100 columns each with
a single character, I would like to concatenate those into a single cell, is
that possible in ANY way?

thanks


How many rows in each column?

You can do it with a simple UDF:

======================
Option Explicit

Function Concat(rg As Range) As String
Dim c As Range

For Each c In rg
Concat = Concat & c.Text
Next c

End Function
========================

<alt<F11 opens the VB Editor.

Ensure your project is highlighted in the project explorer window, then
Insert/Module and paste the code above into the module that opens.

On the worksheet, enter =Concat(rg) where rg is the range of cells you wish to
concatenate.


--ron
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Concatenate an array

Thank you!
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Concatenate an array

On Mon, 3 Jul 2006 06:35:02 -0700, Ed wrote:

Thank you!

You're welcome. Glad to help

--ron
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
Creating a concatenate text list by referencing an array nothingbutjeep Excel Discussion (Misc queries) 0 May 30th 06 09:46 PM
Concatenate Multiple Instances in Array sunfish62 Excel Worksheet Functions 1 June 24th 05 04:56 AM
How do I concatenate the contents of an array in Excel? Johnnie Walker Excel Worksheet Functions 0 February 16th 05 10:11 AM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
VBA Import of text file & Array parsing of that data Dennis Excel Discussion (Misc queries) 4 November 28th 04 10:20 PM


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