How to Make Two Lines in One Cell in Excel

Excel is a powerful tool for formatting data. It's useful to show multiple lines of text in one cell. This makes data easier to read and organize. We'll look at different ways to do this, including a VBA solution for automating the process.

Method 1: Using Alt + Enter (Manual Line Break)

The easiest way to add a line break in a cell is with a keyboard shortcut.

Steps:

  1. Click on the cell where you want to enter multiple lines.
  2. Type the first line of text.
  3. Press Alt + Enter to insert a new line within the cell.
  4. Type the second line.
  5. Press Enter to save the cell content.

Example:

John Doe
Marketing Manager

Method 2: Using CONCATENATE or TEXTJOIN Function

To combine text from different cells into one cell with multiple lines, use the CHAR(10) function (line break in Windows).

Using CONCATENATE:

=A1 & CHAR(10) & B1

Using TEXTJOIN (Available in Excel 2016 and later):

=TEXTJOIN(CHAR(10), TRUE, A1, B1)

Note:

Make sure Wrap Text is enabled for the cell. Select the cell, go to the Home tab, and click Wrap Text.

Method 3: Using a Formula in Excel VBA

For automation, use VBA to insert a line break in a cell.

VBA Code:


Sub InsertLineBreak()
    Dim ws As Worksheet
    Set ws = ActiveSheet
    
    ' Specify the cell where you want the line break
    ws.Range("A1").Value = "John Doe" & vbNewLine & "Marketing Manager"
    
    ' Enable Wrap Text
    ws.Range("A1").WrapText = True
End Sub

Steps to Run VBA Code:

  1. Press Alt + F11 to open the VBA Editor.
  2. Click Insert > Module.
  3. Copy and paste the VBA code.
  4. Press F5 to run the macro.

Conclusion

There are many ways to add two lines in a single Excel cell. The manual Alt + Enter method works well for occasional use. But, formulas and VBA are better for large datasets. Pick the method that suits your needs best!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.