or

Register

or

## How To Combine Multiple Cells Into A Cell With Space, Commas or other separators In Excel?

When you combine the cells from multiple columns or rows into a single cell, the combined data may be separated by nothing. But if you want to separate them with specified marks, such as space, commas, semicolon or others, how can you do? This tutorial will introduce some methods for you.

Concatenate row, column or range of cells into one cell with a specified separator

Kutools for Excel supports a powerful feature-Combine which can help you to merge all data based on rows, columns or a range of cells into one record without losing data. Please see the below demo.    Click to download Kutools for Excel!

#### Concatenate row or column of cells into one cell with space, comma or other separators by using formulas

In Excel, you can use the below formulas to combine a row of cells or a column of cells into a single cell.

##### Method A: Use "&" operator to combine cells

In Excel, you can use the "&" operator to combine different text strings or cell values.

Please enter the below formula to concatenate the cells in multiple columns: (separate the combined results with space, you can replace the blank with other separators as you need.)

=A2&" "&B2&" "&C2

And then, drag the fill handle down to the cells that you want to apply this formula, and the data from different columns have been merged into one cell, see screenshot:

• Tips:
• In the above formula, you can replace the blanks between the & operators with other separators, such as =A2&"-"&B2&"-"&C2
• If you need to combine the cell values from multiple rows, you just need to change the cell reference as this: =A2&" "&A3&" "&A4&" "&A5&" "&A6&" "&A7

##### Method B: Use Concatenate function to combine cells

The Concatenate function in Excel is also used to join multiple text strings or cell values into one cell.

Please enter or copy the below formula into a blank cell:

=CONCATENATE(A2, "-", B2, "-", C2)

And then, drag the fill handle down to the cells that you want to apply this formula, you will get the following result:

• Tips:
• In the above formula, you can replace the “-” character with other separators, such as =CONCATENATE(A2, ";", B2, ";", C2)
• If you need to combine the cell values from multiple rows, you just need to change the cell reference as this: =CONCATENATE(A2, "-", A3, "-", A4, "-", A5, "-", A6, "-", A7)

##### Method C: Use Textjoin function to combine cells

If you have Excel 365 and later versions, there is new function-Textjoin, this function also can help you to combine multiple cells into one cell.

Enter or copy the following formula into a blank cell:

=TEXTJOIN(",",TRUE,A2:C2)

Then, drag the fill handle to apply this formula to other cells, see screenshot:

• Tips:
• In the above formula, you can replace the “,” character with other separators, such as =TEXTJOIN("/",TRUE,A2:C2)
• To combine the cell values from multiple rows, you just need to change the cell reference as this: =TEXTJOIN(",",TRUE,A2:A7)
• This TEXTJOIN also can combine a range of cells into a single cell with a delimiter as this: =TEXTJOIN(",",TRUE,A2:C7)

## Layoff season is coming, still work slowly? -- Office Tab boosts your pace, saves 50% work time!

•  Amazing! The operation of multiple documents is even more relaxing and convenient than single document;
•  Compared with other web browsers, the interface of Office Tab is more powerful and aesthetic;
•  Reduce thousands of tedious mouse clicks, say goodbye to cervical spondylosis and mouse hand;
•  Be chosen by 90,000 elites and 300+ well-known companies!

#### Concatenate row or column of cells into one cell with space, comma or other separators by the User Defined Function

In Excel, you can also create a User Defined Function to combine cells of row or column into a single cell with spaces or specified marks.

1. Hold ALT + F11 keys on the keyboard to open a Microsoft Visual Basic for Application window.

2. Click Insert > Module, and copy the VBA into the module.

VBA: Combine cells based on row or column into one with specific separator:

```Function Combine(WorkRng As Range, Optional Sign As String = "~") As String
Dim Rng As Range
Dim OutStr As String
For Each Rng In WorkRng
If Rng.Text <> " " Then
OutStr = OutStr & Rng.Text & Sign
End If
Next
Combine = Left(OutStr, Len(OutStr) - 1)
End Function
```

Tip: In the above script "Function Combine(WorkRng As Range, Optional Sign As String = "~") As String", the separator "~" is specified to separate the combined result, you can change it to meet your need.

3. Then please type formula =Combine(A2:C2) in a blank cell, and then drag the fill handle over the range that you want to apply this formula, all of the cells in the row will be combined into a cell with dashes. See screenshot:

Tips: With above User Defined Function, you can also combine cell values based on column, you just need to enter this formula =Combine(A2:A7) to get the merged data as you need.

#### Concatenate row or column of cells into one cell with line break by using formulas

Sometimes, you may want to use the line break to separate the concatenated text string, normally, the CHAR(10) will return the line break character. Here, you can use the below methods to solve this task:

##### Method A: Use Concatenate function to combine cells with line break

Here, you can combine the concatenate function with the Char(10) character together to get the merged result which is separated by line break.

1. Please type or copy the below formula:

=CONCATENATE(A2,CHAR(10),B2,CHAR(10),C2)

Then, drag the fill handle down to the cells you want to apply this formula, and you will get the following result:

2. Then, you should click Home > Wrap Text to format the cells, and then, you will get the result as you need:

Tips: To combine the cell values from multiple rows, you just need to change the cell reference as this: =CONCATENATE(A2,CHAR(10),A3,CHAR(10),A4,CHAR(10),A5,CHAR(10),A6,CHAR(10),A7)

##### Method B: Use Textjoin function to combine cells with line break (Excel 365 and later versions)

May be the above formula is somewhat difficult if there are multiple cells needed to be combined, so, the Textjoin function can deal with this task quickly and easily.

Please enter or copy the below formula into a blank cell:

=TEXTJOIN(CHAR(10),TRUE,A2:C2)

After getting the combined results, please remember to format the formula cells to Wrap Text, see screenshot:

Tips: To combine the cell values from multiple rows, you just need to change the cell reference as this: =TEXTJOIN(CHAR(10),TRUE,A2:A7)

#### Concatenate row, column or range of cells into one cell with specified separator by using a wonderful feature

If you are annoying with the above formulas and code, here, I can recommend a useful tool- Kutools for Excel, with its Combine feature, you can quickly combine cell values by row, column or a range into one single cell.

Tips:To apply this Combine feature, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

After installing Kutools for Excel, please do as this:

1. Select a range cell values that you want to combine into a cell.

2. Please apply this function by clicking Kutools > Merge & SplitCombine Rows, Columns or Cells without Losing Data. See screenshot:

3. In the popped out dialog box, please specify the operations you need as following screenshot shown:

4. Then, click Ok, you will get the result as below screenshot shown:

1). Combine cell values into one cell for each row:

2). Combine cell values into one cell for each column:

3). combine a range of cell values into one single cell:

#### More relative combine rows and columns articles:

• Merge And Combine Rows Without Losing Data In Excel
• Excel only keeps the data in the upper-left most cell, if you apply "Merge & Center" command (Home tab > Merge & Center on the Alignment panel) to merge rows of data in Excel. Users have to use another method to merge multiple rows of data into one row without deleting data.
• Combine Duplicate Rows And Sum The Values In Excel
• In Excel，you may always meet this problem, when you have a range of data which contains some duplicate entries, and now you want to combine the duplicate data and sum the corresponding values in another column, as following screenshots shown. How could you solve this problem?
• Combine Date And Time Into One Cell In Excel
• There are two columns in a worksheet, one is the date, the other is time, as shown as below, is there any way to quickly combine these two columns into one, and keep the time format?
• Concatenate Cells Ignore Or Skip Blanks In Excel
• Excel’s Concatenate function can help you to combine multiple cell values into one cell quickly, if there are some blank cells within the selected cells, this function will combine the blanks as well. But, sometime, you just want to concatenate cells with data and skip the empty cells, how could you finish it in Excel?

## The Best Office Productivity Tools

### Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

• Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
• Merge Cells/Rows/Columns and Keeping Data; Split Cells Content; Combine Duplicate Rows and Sum/Average... Prevent Duplicate Cells; Compare Ranges...
• Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
• Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
• Favorite and Quickly Insert Formulas, Ranges, Charts and Pictures; Encrypt Cells with password; Create Mailing List and send emails...
• Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
• Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
• Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
• Pivot Table Grouping by week number, day of week and more... Show Unlocked, Locked Cells by different colors; Highlight Cells That Have Formula/Name...

### Office Tab - brings tabbed interface to Office, and make your work much easier

• Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Say something here...
symbols left.
###### or post as a guest, but your post won't be published automatically.
• To post as a guest, your comment is unpublished.
· 1 years ago
I would like to know if I have a list of people with their information in different cells in one column but different row how to combine them in one cell For e,g I have one person teaching English, math and science and his name is repeated in one column but the courses are in different rows so I want to combine all the courses in one cell for that teacher. if I have 50 teachers I need to have all the courses that the teacher is teaching in one cell.
• To post as a guest, your comment is unpublished.
· 1 years ago
Hi, Lavina,
Do you mean to combine multiple cell values in a column based on duplicate names in another column as below screenshot shown:

You can insert a screenshot to make your problem more intuitive.
• To post as a guest, your comment is unpublished.
· 1 years ago
VBA doesn't work for me, excel 2016.
• To post as a guest, your comment is unpublished.
· 2 years ago
Working on trying to get your VBA code to work however I keep getting a #NAME? error. How do I fix this? I've used this code before and it worked wonderfully but now it gives me an error.
• To post as a guest, your comment is unpublished.
· 2 years ago
But it is not working for large data. I have around 50000 rows to combine in single cell.
• To post as a guest, your comment is unpublished.
· 3 years ago
415xxe 5687sdc sa4567
415xxe 5687sdc sa4567
415xxe 5687sdc sa4567
415xxe 5687sdc sa4567

I need to separate these in different columns and then put a comma behind the last column
• To post as a guest, your comment is unpublished.
· 3 years ago
The VBA code does not work

I get an error Microsoft Visual Basic for Applications - Compile error: Syntax error

then the line "If Rng.Text "," Then" is highlighted in blue and on the top highlighted in yellow it says this "function combine(workrng as range, optional sign as string = ",") as string

I am using excel 2016 on a pc
• To post as a guest, your comment is unpublished.
· 3 years ago
I genuinely enjoy studying on this website, it holds good content. Never fight an inanimate object. by P. J. O'Rourke. dfdkbafbadfkagdd
• To post as a guest, your comment is unpublished.
· 3 years ago
how to combine 2 cell with space in between with 2 independent cell format. Eg. If one cell is Red digits & other cell has digits in green, it should combine with Red & green digits.
• To post as a guest, your comment is unpublished.
· 3 years ago
The VBA code worked really well thanks.

My only issue is that it is including blanks so that my combined output ends up looking like this: "test, test, , , , , , test"

How could I get it to exclude blank cells within the range?
• To post as a guest, your comment is unpublished.
· 2 years ago
• To post as a guest, your comment is unpublished.
· 2 years ago
instead of the line in the original code:

If Rng.Text <> ", " Then
OutStr = OutStr & Rng.Text & Sign

you need to add a "test" to determine if the cell is empty followed by the statement above which adds the delimiter. Delete the above 2 lines and then Copy the following code in and your COMBINE function will remove the blanks from your list.

If IsEmpty(Rng.Value) = True Then

OutStr = OutStr & ""

ElseIf Rng.Text <> ", " Then

OutStr = OutStr & Rng.Text & Sign
• To post as a guest, your comment is unpublished.
· 3 years ago
The VBA macro worked very well after I adjusted for the my cell locations and I was able to add a space after the comma for a better display of the data.
• To post as a guest, your comment is unpublished.
· 3 years ago
the merge formula was great, except one of my columns of data were dates, and the dates had to be formatted MM/DD/YY - but once merged, the date converted to a decimal figure. I couldn't use the formula.
• To post as a guest, your comment is unpublished.
· 3 years ago
How do i get results show the following values:
A B C
10 10 =CONCATENATE(A1,",",B1,",",C1) RESULTS 10,,10
10 20 30 =CONCATENATE(A1,",",B1,",",C1) RESULTS 10,20,10
10 30 =CONCATENATE(A1,",",B1,",",C1) RESULTS 10,30,

ABOVE IT IS SHOWING COMMA IN BETWEEN TWO VALUES OR AFTER. I DONT WANT THE COMMA WHERE THE VALUE IS NOT THERE
• To post as a guest, your comment is unpublished.
· 3 years ago
Try this.

=SUBSTITUTE(IF(A1="","",A1&",") & IF(B1="","",B1) & IF(C1="","","," & C1),",,",",")
• To post as a guest, your comment is unpublished.
· 4 years ago
Thanks a ton VBA save my hours....!!!
• To post as a guest, your comment is unpublished.
· 4 years ago
Thanks for the macro, it worked great!!
• To post as a guest, your comment is unpublished.
· 4 years ago
I am having issues, the cells G2-N2 (down thousands of rows) need to be merged to one column using a comma but no space between them. However, if the cell is EMPTY, it needs to SKIP the cell, with no input of a comma. I cannot find any HELP menu for this and I am up against a deadline and need this shortcut for thousands of products I am importing. Any and all help appreciated.
• To post as a guest, your comment is unpublished.
· 4 years ago
Thanks a lot.. this info is very helpful.
• To post as a guest, your comment is unpublished.
· 4 years ago
Thank you. That is the best explanation I have found yet! I am having trouble expanding this over hundreds of columns though. Can you clarify the point where you say "Dragging the fill handle over the range that you want to apply this formula, all of the cells in a row will be combined into a cell with commas" I am not sure how to do this.
• To post as a guest, your comment is unpublished.
· 5 years ago
i want to merage two cells with the following results
A and B = A ,B
means A column space comma B column
• To post as a guest, your comment is unpublished.
· 5 years ago
Thanks for the VBA code!!!!It saved my time......... :-)
• To post as a guest, your comment is unpublished.
· 5 years ago
Hi,
thanks so much for the helpful resource!!!
May I ask how to modify the VBA Module to have both "," and " "?
Thank you so much!
• To post as a guest, your comment is unpublished.
· 5 years ago
[quote name="Srina"]Hi,
thanks so much for the helpful resource!!!
May I ask how to modify the VBA Module to have both "," and " "?
Thank you so much![/quote]

Most of all, how to end the list with no space and no comma? So to select entire rows of a spreadsheet as resource, which might include a different number of columns?

• To post as a guest, your comment is unpublished.
· 5 years ago
I used your VBA formula a few days ago and it worked beautifully. I'm using it again today and I keep getting a #NAME? error. I've tried all sorts of things and can't get it to work. What am I doing wrong?
• To post as a guest, your comment is unpublished.
· 5 years ago

Try to contact me at jaychivo#extendoffice.com. Please replace # with @.

:-)
• To post as a guest, your comment is unpublished.
· 3 years ago
Hi!

I have a spreadsheet of over 23,000 serial numbers in Column A, then each serial number has a one-digit Assign number in Column B, and finally an individualized Application number that belongs to both the serial number and assigned number in Column C.

Looks like this:

A B C
123456 1 1212121
987655 2 5656565
606060 1 4343434
606060 1 8989898

How would I combine just the rows of data that have the SAME Serial number and Assign number but different application numbers using a comma?

Such as, I need:

606060 1 4343434, 8989898

Any help would be super appreciated!!!
• To post as a guest, your comment is unpublished.
· 5 years ago
Thank you. This was really a savior! I have one question. I want to merge EAN codes. It works like a charm in the same sheet. But when I take EAN codes from another sheet, I get the result:

#######,########,#######,#######

Where might be the problem?

many thanks
• To post as a guest, your comment is unpublished.
· 6 years ago
Great, limpidly clear
• To post as a guest, your comment is unpublished.
· 6 years ago
awesome: helped with my project and saved many hours of work...thanks much.
• To post as a guest, your comment is unpublished.
· 6 years ago
Thank you a lot. I found this very useful.
Regards,