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
 
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.
I have not tested out Mike's code, but from your description... does adding this line at the beginning of the code make it work for that situation?

Code:
Application.Volatile
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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


Excellent!!! This UDF can concatenate even noncontiguous cells.
 
Upvote 0

Forum statistics

Threads
1,215,898
Messages
6,127,633
Members
449,392
Latest member
Kersh82

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