Concatenate an entire column into one cell? Module needed?

raceonusa

Board Regular
Joined
Mar 28, 2007
Messages
61
Basically what I need to do is the equivalent of typing this in once cell...

=A1&A2&A3&A4&A5&A6&A7&A8&A9&A10&A11... etc...

Is there an easy way to type this, or a formula that can do the same thing?

I've tried =A:A but this adds the total, I need to concatenate them
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You could use a UDF. For your case the formula would be =ConcatRange(A:A)

Code:
Function ConcatRange(inputRange As Range, Optional delimiter As String) As String
    Dim oneCell As Range
    With inputRange
        If Not (Application.Intersect(.Parent.UsedRange, .Cells) Is Nothing) Then
            For Each oneCell In Application.Intersect(.Parent.UsedRange, .Cells)
                If oneCell.Text <> vbNullString Then
                    ConcatRange = ConcatRange & delimiter & oneCell.Text
                End If
            Next oneCell
            ConcatRange = Mid(ConcatRange, Len(delimiter) + 1)
        End If
    End With
End Function
 
Upvote 0
This UDF works really well.
When you select a range of multiple rows and colums, it concatenates the range row by row. I was wondering, could you make an alternative version that concatenates by columns?
Thanks :biggrin:
 
Upvote 0
I would like to know if you could show me how to add commas between the numbers so that it will be displayed this way A1,A2,A3,A4.......

ie if A1=10 A2=20 A3=30 A4=40 ... it will show this way 10,20,30,40

Thank you! :)
 
Upvote 0
You just need to specify the delimiter:
=ConcatRange(A:A, ",")

for example.
 
Upvote 0
Is there away to make the =concatrange update automatically? If I am using a pivot table and the names in the concatenation change it is not automatically updating. Thanks!
 
Upvote 0
I wish it did. The cells it is concatenating are an If statement looking at a pivot table. So when the cells change the concatenation should change. The only way to get it to change is when I click on the cell and hit enter in the formula box again.
 
Upvote 0

Forum statistics

Threads
1,215,154
Messages
6,123,327
Members
449,098
Latest member
thnirmitha

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