Sometimes we need to combine multiple cells into one keeping with the line break. Undoubtedly, Excel provides some quickest features to do that. In this article, I’ll discuss 5 handy methods including functions and VBA code to combine cells into one with the line break in Excel.
Download Practice Workbook
5 Methods to Combine Cells into One with Line Break in Excel
Let’s introduce the following dataset where the name of some employees (Employee Name) are given along with their States and Email ID.
1. Using the Ampersand Operator and CHAR Function
Assuming that you want to get combined information by merging two or more cells. Such as in the following example, I am going to find the Combined Information (E5:E9 cell range) covering the information of the previous 3 fields (the Name, States, and Email ID of each employee).
Luckily, you may extract the output from the different cell ranges by using the ampersand symbol (&) and CHAR function. Just insert the following formula in the E5 cell.
=B5&CHAR(10)&C5&CHAR(10)&D5
Here, B5 is the starting cell of the Employee Name, C5 is the starting cell of the States, and D5 is the starting cell of the Email ID.
In the above formula, the CHAR function checks the character on the basis of a given number or code. The ASCII code for inserting a line break is 10, so we have to use CHAR(10) to embed a line break between the combined cells.
After inserting the formula, press ENTER and drag down the plus sign located at the lower-right corner of the E5 cell (Fill Handle Tool). Immediately, you’ll get the output (E5:E9 cell range).
Now, the three cells are combined but you cannot see the output with line break until you turn on the Wrap Text option from the Alignment ribbon in the Home tab. Before doing make sure that you select the output.
After adjusting the row height, you’ll get the following output where the cells are combined keeping with the line break.
Read More: How to Combine Names in Excel with Space (6 Approaches)
2. Using the CONCATENATE Function to Combine Cells into One
In addition, you may accomplish the same task using the CONCATENATE function which combines multiple strings to a single string. So the adjusted formula associated with the CHAR function will be-
=CONCATENATE(B5,CHAR(10),C5,CHAR(10),D5)
After pressing the ENTER key, use the Fill Handle Tool. So, the output will look like the following.
Read More: How to Combine Two Cells in Excel (6 Quick Methods)
3. Utilizing the CONCAT Function
Furthermore, you may unify multiple cells into one keeping the line break utilizing the CONCAT. As you know, Microsoft recommends the function instead of using the CONCATENATE function. However, the combined formula for E5 cell will be-
=CONCAT(B5,CHAR(10),C5,CHAR(10),D5)
Read More: Shortcut for Merge and Center in Excel (3 Examples)
4. Combine Cells Applying the TEXTJOIN Function with Line Break
If you’re using Microsoft 365 version (any upper versions including Excel 2019), you may apply the TEXTJOIN function. The function joins multiple strings including a delimiter character. Whatever the formula for today’s dataset will be like the following.
=TEXTJOIN(CHAR(10),TRUE,B5:D5)
Here, B5:D5 is the cell range covering three cells to combine into one. Besides, I used TRUE for excluding any empty cells. But if you want to count empty cells, you may input the FALSE.
5. Combine Cells into One with Line Break Using the VBA Code
Lastly, if you want, you may utilize the VBA code for combining multiple cells to one with a line break. Just follow the step-by-step process.
Step 01:
Firstly, open a module by clicking Developer > Visual Basic.
Secondly, go to Insert > Module.
Step 02:
Now, copy the following code.
Sub CombiningCells_VBA()
Range("E5").Value = Range("B5").Value & vbNewLine & Range("C5").Value & vbNewLine & Range("D5").Value
Range("E6").Value = Range("B6").Value & vbNewLine & Range("C6").Value & vbNewLine & Range("D6").Value
Range("E7").Value = Range("B7").Value & vbNewLine & Range("C7").Value & vbNewLine & Range("D7").Value
Range("E8").Value = Range("B8").Value & vbNewLine & Range("C8").Value & vbNewLine & Range("D8").Value
Range("E9").Value = Range("B9").Value & vbNewLine & Range("C9").Value & vbNewLine & Range("D9").Value
End Sub
In the above code, I specified the output cell as the E5 cell with the Range.Value property. Similarly, the input cells (B5, C5 and D5) are defined. But I utilized the Ampersand operator and vb New Line field to combine the multiple cells and keep the line break respectively. Later, I applied the same procedure for the rest of the cells.
Step 03:
Next, if you run the code (the keyboard shortcut is F5 or Fn + F5), you’ll see the following output.
Note: You may also use the vbCrLf and vbLf constants instead of using the vbNewLine.
Read More: Excel Shortcut to Merge Cells (3 Methods + Bonus)
Things to Remember
- If you want to input an array or cell range, you should use the TEXTJOIN function. Because the CONCATENATE or CONCAT function deals with individual cells.
- Furthermore, you might combine cells into one with a line break separated by a delimiter e.g. comma.
Conclusion
That’s the end of today’s session. I strongly believe you may combine cells into one with a line break easily using the above methods. Anyway, if you have any queries or recommendations, please share them in the comments section below.
How can I use this formula, but not have the line breaks populate the result cell if the data cells are empty that I’m pulling from? ie – I have a large amount of data I’m drawing from, and my results cell becomes extremely tall with empty fields.
Dear Gen,
You can use the formula.
=TEXTJOIN(delimiter,TRUE,cell_range)
Here, for E5 cell you can write.
=TEXTJOIN(“-“,TRUE,B5:D5)
Here, the character “-” is used to separate the combined text.
This TEXTJOIN function is available only in Office 2019 and Microsoft 365.
The Excel TEXTJOIN function joins multiple values from a row, column or range of cells with specific delimiter.
For other versions of Excel, you can write the formula in the E5 cell based on B5,C5 and D5 cells like.
=B5&IF(C5<>“”,”-“&C5,””)&IF(D5<>“”,”-“&D5,””)
Finally, you need to set your column width to place the output in the cell perfectly and also need to wrap text.
By using either of these two formulas you can ignore empty cells to combine cells into one.
Regards,
Towhid
Excel & VBA Content Developer
ExcelDemy