How to Move New Lines in a Cell to Columns in Google Sheets

Text wrapping and new lines are two different types of cell formatting in Google Sheets. One of the benefits of using new lines over text wrapping is you can move the new lines in a cell to columns using a formula.

The Text Wrapping is a built-in feature which lets users wrap the values in a cell and thus restrict it overflowing into the adjoining cells.

The below image depicts what is text wrapping and new lines in a cell in Sheets.

Text Wrapping and New Lines in a Cell:

Text wrapping in Sheets

In this post I am elaborating on the following cell formatting related tips.

  1. How to quickly add new lines in a cell in Google Sheets?
  2. How to split/move new lines to columns in Sheets.
  3. Clean new lines and insert a comma between strings.

How to Add New Lines in a Cell in Sheets

To add new lines in a cell, follow the below tips.

If the cell is blank;

Assume you want to add 5 new lines in cell A1. To do that double click the cell A1 (or hit the shortcut key F2). Then hit Alt+Enter 4 times.

If the cell has already a value;

If you want to move the existing text in cell A1 into new lines within that cell, double click the cell and move the cursor pointer to the position from which you want the new line to start. Then hit Alt+Enter.

Cleaning New Lines and Inserting Comma as Separator

You can reverse the new lines in a cell in Google Sheets using the CLEAN function as below.

=clean(D2)
Quickly clean a cell content in Sheets

I know it looks weird. You must replace the new line character with commas to make the text readable. That you can do as follows.

=SUBSTITUTE(D2,char(10),", ")

The SUBSTITUTE function replaces the new line character which is represented by the formula char(10) with a comma and an extra space. So the output will be as “Tracy, Matthew, Ada, Robin” which is obviously readable, right?

You can additionally include the CLEAN function with the above formula to ensure that other hidden characters, if any, are removed.

=clean(SUBSTITUTE(D2,char(10),", "))

How to Move New Lines to Columns in Google Sheets

To move the new lines to columns, use the SPLIT function.

=split(D2,char(10))

You can group items in a single cell using the new lines. Here is one example.

Group wise new lines in a cell

As you can clearly see, blank lines separate each group. You can move such groups to columns using a combination of formula. Here is that formula. The explanation follows.

=ArrayFormula(transpose(split(transpose(split(substitute(SUBSTITUTE(B4,char(10)&char(10),"|"),char(10),"^"),"|")),"^")))
Formula to move new lines in a cell to columns in Sheets

Formula Logic/Explanation:

Step # 1:

The formula first substitutes the double new line (blank line generated using char(10) twice) with the pipe | symbol.

=SUBSTITUTE(B4,char(10)&char(10),"|")

Step # 2:

In the next step another substitution replaces the single new line with the caret ^symbol.

=substitute(SUBSTITUTE(B4,char(10)&char(10),"|"),char(10),"^")

Step # 3:

Time to split and transpose the text separated by the pipe symbol.

=transpose(split(substitute(SUBSTITUTE(B4,char(10)&char(10),"|"),char(10),"^"),"|"))

You will get the output as below.

Name of Person^Tracy^Matthew^Ada^Robin
Emp. Code^EMP1105^EMP1106^EMP1107^EMP1108
Basic Pay^450.00^450.00^400.00^425.00

Step # 4:

Split the text separated by the caret symbol and transpose again. That’s our final formula.

I hope I have well detailed on how to move new lines in a cell to columns in Google Sheets. Also, I have included some additional tips. If you find this tutorial useful, please do share. Thanks.

You May Like: How to Wrap Text Using Formula in Google Sheets [One Word Per Line].

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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