Concatenate large numbers of cells

S

Seldonian Crisis

I've got to concatenate 416 cells within a row, the resulting text also needs
to be split by commas . do i have to manually write out
CONCATENATE(A1,CHAR(44),B1,CHAR(44),C1... etc or is there a way of speeding
this up?
 
S

Stephen

Seldonian Crisis said:
I've got to concatenate 416 cells within a row, the resulting text also
needs
to be split by commas . do i have to manually write out
CONCATENATE(A1,CHAR(44),B1,CHAR(44),C1... etc or is there a way of
speeding
this up?

I think you will run into several problems doing this. I would use an
iterative approach:
In B1 put the formula =A1
In B2 put the formula =A2&","&B1
Copy this latter formula across row 2 as far as you need.
 
K

Kevin B

Skip the concatenate formula and just use the cell addresses as follows:

=A1&", "&B2&", "&C3 (adding &", "& after all cell addresses with the
exception of the last one.)
 
G

Gord Dibben

You could use 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(range)


Gord Dibben MS Excel MVP
 
S

Seldonian Crisis

Thank you, I officially owe you a drink.

Stephen said:
I think you will run into several problems doing this. I would use an
iterative approach:
In B1 put the formula =A1
In B2 put the formula =A2&","&B1
Copy this latter formula across row 2 as far as you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top