Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in Excel to take a column and convert it to a concatenated string

I want to take a list of names that are in multiple rows and combined them into a single cell like this:

Joe
Bob
George

and convert that into one cell that has this:

"Joe", "Bob", "George"

like image 702
leora Avatar asked Jun 18 '10 18:06

leora


People also ask

Can you concatenate a column?

Use the CONCATENATE function: Click Text functions and select CONCATENATE. Enter A1 in the text1 field, B1 in the text2 field, and C1 in the text3 field. Click OK. The columns are combined.


2 Answers

Try using TRANSPOSE function and pressing F9 on it:

+---+--------+
|   |   A    |
+---+--------+
| 1 | Joe    |
| 2 | Bob    |
| 3 | George |
+---+--------+

B1: (type in function bar)

=TRANSPOSE(A1:A3)

Highlight TRANSPOSE(A1:A3), and press F9.

It will give you:

{"Joe","Bob","George"}

Copy and paste that list. That's it.

To concatenate the words, you just have to do:

=CONCATENATE(TRANSPOSE(A1:A3))

Highlight TRANSPOSE(A1:A3), press F9, then remove the brackets:

=CONCATENATE("Joe","Bob","George")
like image 108
live-love Avatar answered Nov 15 '22 08:11

live-love


There are two basic ways that I know of.

Quickest way -

  1. Column A lists your names
  2. Copy the value of A1 to B1 - "Joe"
  3. In B2, enter the formula `=B1 & ", " & A2`
  4. Select B2, Copy the formula, and paste down the rest of column B the entire length of column A. The last cell in column B will contain a comma separated list of values from column A.

Better way -
Make your own vb function that iterates across a range of cells, and instead of summing them like sum, just concatenate them.

I do this all the time, so if anyone knows of an actual built-in Excel function buried somewhere in MS documentation that concatenates ranges, you will save the day.

like image 44
bob-the-destroyer Avatar answered Nov 15 '22 07:11

bob-the-destroyer