Concatenate

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Hi, Is there a way to concatenate multiple cells into 1
cell separated by a , without having to select each cell
using the usual concatenate function but by selecting a
range such as A1:A6.

A B
1 Text1 =CONCATENATE(A1,",",A2,",",A3,",",A4)
2 Text2
3 Text3
4 Text4
5 Text5
6 Text6

Thanks
 
One way (using a UDF):

Public Function MultiCat(ByRef rRng As Excel.Range, _
Optional ByVal sDelimiter As String = "") As String
Dim rCell As Range
For Each rCell In rRng
MultiCat = MultiCat & sDelimiter & rCell.Text
Next rCell
MultiCat = Mid(MultiCat, 2)
End Function


Call as

=MultiCat(A1:A4,",")
 
Lee,

A UDF is a User Defined Function, that is a piece of VBA code that is used
in a similar manner to built-in Excel worksheet functions.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top