formula or functions needed

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
311
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
I have column A which has

1234
123461
123151
11321
(note that the rows are dynamic. it is 4 but can be more)


I need to change the values in column A and make them into a comma-separated list in another cell that the user can easily copy and paste into another program. It should be like this:-

1234,123461,123151,11321

What is the quickest way to do it ? Formulas ? I tried paste special transpose but cannot achieve it ? I can do it in macro but wondering if there are other simple ways to do it.

Any help? :)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
a helper cell with =a1&a2&a3......up to say a20

if a5 = blank it will not "show" - - do you need the commas ?
 
Upvote 0
You can type =a1:a4 (or whatever your range is) in another cell, highlight, F9, and copy/paste the resulting array of constants from the formula bar. Ctrl-h can change the delimiters if you wish. Or type =a1&a2 in a5 and drag down for an incremental concat then copy/paste as values the desired cell.
 
Last edited:
Upvote 0
If you have Excel 2016, then you can use
Code:
=TEXTJOIN(",",,A1:A4)

If the last row is not known then you can use this(For this also you need Excel 2016):

Code:
 =TEXTJOIN(",",,A:A)
 
Last edited:
Upvote 0
Hi

Please try with below coding

Code:
Sub Test()


Dim i As String
Dim Lrow As String
Dim Result As String


Lrow = Range("A100000").End(xlUp).Row


Range("A1:A" & Lrow).Select


For Each Cell In Selection
    i = Cell.Value
    If Result = "" Then
    Result = i
    Else
    Result = Result & "," & i
    End If
Next


Range("B1").Value = "'" & Result


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,914
Messages
6,122,211
Members
449,074
Latest member
cancansova

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top