E.g
A1:I
A2:am
A3:a
A4:boy
I want to merge them all to a single cell "Iamaboy"
This example shows 4 cells merge into 1 cell however I have many cells (more than 100), I can't type them one by one using A1 & A2 & A3 & A4
what can I do?
E.g
A1:I
A2:am
A3:a
A4:boy
I want to merge them all to a single cell "Iamaboy"
This example shows 4 cells merge into 1 cell however I have many cells (more than 100), I can't type them one by one using A1 & A2 & A3 & A4
what can I do?
For those who have Excel 2016 (and I suppose next versions), there is now directly the CONCAT function, which will replace the CONCATENATE function.
So the correct way to do it in Excel 2016 is :
which will produce :
For users of olders versions of Excel, the other answers are relevant.
For Excel 2011 on Mac it's different. I did it as a three step process.
=B1
. For the next row to row N, the formula is=Concatenate(",",A2)
. You end up with:=B1
. For all other rows to N, the formula is=Concatenate(C1,B2)
. And you get:The last cell of the list will be what you want. This is compatible with Excel on Windows or Mac.
I know this is really a really old question, but I was trying to do the same thing and I stumbled upon a new formula in excel called "TEXTJOIN".
For the question, the following formula solves the problem
The signature of "TEXTJOIN" is explained as TEXTJOIN(delimiter,ignore_empty,text1,[text2],[text3],...)
I use the
CONCATENATE
method to take the values of a column and wrap quotes around them with columns in between in order to quickly populate theWHERE IN ()
clause of a SQL statement.I always just type
=CONCATENATE("'",B2,"'",",")
and then select that and drag it down, which creates=CONCATENATE("'",B3,"'",",")
,=CONCATENATE("'",B4,"'",",")
, etc. then highlight that whole column, copy paste to a plain text editor and paste back if needed, thus stripping the row separation. It works, but again, just as a one time deal, this is not a good solution for someone who needs this all the time.In simple cases you can use next method which doesn`t require you to create a function or to copy code to several cells:
In any cell write next code
Where A1:A9 are cells you would like to merge.
F9
After that, the cell will contain the string:
Source: http://www.get-digital-help.com/2011/02/09/concatenate-a-cell-range-without-vba-in-excel/
Update: One part can be ambiguous. Without leaving the cell means having your cell in editor mode. Alternatevly you can press F9 while are in cell editor panel (normaly it can be found above the spreadsheet)
Use VBA's already existing
Join
function. VBA functions aren't exposed in Excel, so I wrapJoin
in a user-defined function that exposes its functionality. The simplest form is:Example usage:
entered as an array formula (using Ctrl-Shift-Enter).
Now,
JoinXL
accepts only one-dimensional arrays as input. In Excel, ranges return two-dimensional arrays. In the above example,TRANSPOSE
converts the 4×1 two-dimensional array into a 4-element one-dimensional array (this is the documented behaviour ofTRANSPOSE
when it is fed with a single-column two-dimensional array).For a horizontal range, you would have to do a double
TRANSPOSE
:The inner
TRANSPOSE
converts the 1×4 two-dimensional array into a 4×1 two-dimensional array, which the outerTRANSPOSE
then converts into the expected 4-element one-dimensional array.This usage of
TRANSPOSE
is a well-known way of converting 2D arrays into 1D arrays in Excel, but it looks terrible. A more elegant solution would be to hide this away in theJoinXL
VBA function.