Convert a column into a comma separated list
Assuming your data starts in A1 I would put the following in column B:
B1:
=A1
B2:
=B1&","&A2
You can then paste column B2 down the whole column. The last cell in column B should now be a comma separated list of column A.
- Copy the column in Excel
- Open Word
- "Paste special" as text only
- Select the data in Word (the one that you need to convert to text separated with
,
), press Ctrl-H (Find & replace) - In "Find what" box type
^p
- In "Replace with" box type
,
- Select "Replace all"
If you have Office 365 Excel then you can use TEXTJOIN():
=TEXTJOIN(",",TRUE,A:A)
I actually just created a module in VBA which does all of the work. It takes my ranged list and creates a comma-delimited string which is output into the cell of my choice:
Function csvRange(myRange As Range)
Dim csvRangeOutput
Dim entry as variant
For Each entry In myRange
If Not IsEmpty(entry.Value) Then
csvRangeOutput = csvRangeOutput & entry.Value & ","
End If
Next
csvRange = Left(csvRangeOutput, Len(csvRangeOutput) - 1)
End Function
So then in my cell, I just put =csvRange(A:A)
and it gives me the comma-delimited list.
An alternative approach would be to paste the Excel column into this in-browser tool:
convert.town/column-to-comma-separated-list
It converts a column of text to a comma separated list.
As the user is copying and pasting to another program anyway, this may be just as easy for them.