Excel: How to Use TEXTJOIN Function with Line Break


You can use the TEXTJOIN function in Excel to combine multiple text values using a specific delimiter.

To use the TEXTJOIN function with a line break as the delimiter, you can use the following formula:

=TEXTJOIN(CHAR(10), TRUE, A1:A5)

This particular formula combines the text values in cells A1 through A5, using a line break as the delimiter.

Note: In Excel, CHAR(10) is used to represent a line break.

The following examples shows how to use this formula in practice.

Example: How to Use TEXTJOIN Function with Line Break in Excel

Suppose we have the following column of phrases in Excel:

Suppose we would like to combine each of these phrases into one cell, using a line break as the delimiter.

We can type the following formula into cell C1 to do so:

=TEXTJOIN(CHAR(10), TRUE, A1:A5)

The following screenshot shows how to use this formula in practice:

In order to actually see the line breaks in Excel, we must click on cell C1 and then click the Wrap Text icon within the Alignment group in the Home tab:

Once we click this icon, we will be able to see the line breaks in cell C1:

Excel TEXTJOIN function with line breaks

Notice that each of the phrases from the range A1:A5 have been combined into one cell, using line breaks as the delimiter.

How This Formula Works

Recall the formula that we used to combine all of the phrases into one cell:

=TEXTJOIN(CHAR(10), TRUE, A1:A5)

This formula uses the TEXTJOIN function, which uses the following basic syntax:

TEXTJOIN(delimiter, ignore_empty, text1, text2, text3…)

where:

  • delimiter: The delimiter to use when combining text
  • ignore_empty: Whether or not to ignore empty cells
  • text1, text2, text3, …: The text values to be combined

We used this particular function to combine each phrase in the range A1:A5 by using a line break ( CHAR(10) )as a delimiter and by using the argument TRUE to ignore any empty cells in the range.

Note: You can find the complete documentation for the TEXTJOIN function in Excel here.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Convert Column into Comma Separated List
Excel: How to Use a Concatenate If Formula
Excel: How to Concatenate Values and Keep Leading Zeros

Leave a Reply

Your email address will not be published. Required fields are marked *