Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel - getting a list of numbers into one cell

Status
Not open for further replies.

stemitch2000

Programmer
Nov 12, 2003
47
0
0
GB
Hello,
I have got a column of cells, with numbers in them. I would like to generate just one cell with this numbers seperate by a comma. i.e.

10
2
3
4

would end up like

10, 2, 3, 4

This is to go into a comparison table, and nothing to do with CSV - though that is an option.
 
I think the formula you want is concatenate, for instance:

=CONCATENATE(A1, ", ", A2 ", ", A3 ", ", A4)

would produce 10, 2, 3, 4 if your numbers were in A1 to A4.

HTH

BerylM
 
Select the cells and run this - It will put the value in A1

Sub Concat()

n = ""
For Each cel In Selection
If n = "" Then
n = n & cel.Value
Else
n = n & "," & cel.Value
End If
Next cel
Range("A1").Value = n

End Sub

Regards
Ken................

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top