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

This tutorial explains how to move new lines in a cell to columns or rows in Google Sheets. Before that, let’s understand what a new line is and how to add or remove them.

Introduction: Understanding New Lines

Text wrapping and new lines are two different ways of formatting text in Google Sheets. One advantage of using new lines instead of text wrapping is that you can move new lines in a cell to columns using a formula.

Text Wrapping is a built-in feature that allows users to wrap text within a cell, preventing it from overflowing into adjacent cells.

Text wrapping vs. new lines in Google Sheets

How to Add New Lines in Google Sheets

If you want to insert a new line within a cell, double-click the cell, place the cursor at the desired position, then press:

  • Windows: Alt + Enter
  • Mac: Option + Enter

How to Remove New Lines in Google Sheets

To remove new lines from a cell, use the CLEAN function, not the TRIM function.

=CLEAN(D2)
Remove new lines in Google Sheets using the CLEAN function

If the new lines were inserted without spaces, the output may look cluttered. To make the text more readable, replace new line characters with spaces using the SUBSTITUTE function:

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

This replaces each new line character (represented by CHAR(10)) with a space.

Moving New Lines to Columns or Rows in Google Sheets

Google Sheets provides a “Split text to columns” option under the Data menu, but it doesn’t support new lines (CHAR(10)) as a delimiter. Since there’s no built-in way to split text by new lines using that method, we must use formulas instead.

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

=SPLIT(D2, CHAR(10))

If you want to move new lines to rows, combine TOCOL with SPLIT:

=TOCOL(SPLIT(D2, CHAR(10)))

These formulas allow you to restructure data by breaking multi-line values into separate columns or rows.

Moving New Lines to Columns While Keeping Groups

Sometimes, new lines within a cell are used to separate groups of data with an empty line in between. If you want to preserve these groups while moving new lines to columns, use the following formula:

=ArrayFormula(TRANSPOSE(SPLIT(TRANSPOSE(SPLIT(SUBSTITUTE(SUBSTITUTE(B4, CHAR(10)&CHAR(10), "|"), CHAR(10), "^"), "|")), "^")))
Example of moving new lines in a cell to columns while preserving groups in Google Sheets

How This Formula Works

  1. Replace Double New Lines
    The formula first replaces consecutive new lines (empty lines) with a pipe (|) symbol.
    =SUBSTITUTE(B4, CHAR(10)&CHAR(10), "|")
  2. Replace Single New Lines
    Next, it replaces single new lines with a caret (^).
    =SUBSTITUTE(SUBSTITUTE(B4, CHAR(10)&CHAR(10), "|"), CHAR(10), "^")
  3. Split and Transpose
    The formula then splits the text at each pipe (|) symbol and transposes the results.
    =TRANSPOSE(SPLIT(SUBSTITUTE(SUBSTITUTE(B4, CHAR(10)&CHAR(10), "|"), CHAR(10), "^"), "|"))
  4. Final Split & Transpose
    Finally, it splits the text at each caret (^) symbol and transposes it again, converting new lines into separate columns while preserving groups.

Conclusion

This tutorial covered how to move new lines in a cell to columns and rows using Google Sheets formulas. We also explored handling grouped data while moving new lines.

If you found this guide helpful, please share it. Thanks for reading!

Resources:

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Google Sheets: Get the Last Row with Any Data Across Multiple Columns

It’s common to have several empty rows at the bottom of a Google Sheet,...

How to Calculate Digital Root in Google Sheets

The digital root is the single-digit value you get by repeatedly summing the digits...

How to Build an Advanced Book Tracker in Google Sheets: Formulas Explained

If you're tired of forgetting what you've read, which books you rated 5 stars,...

Google Sheets Reading List Tracker Template (Free Download)

Looking for a smarter, more visual way to manage your reading goals? This Google...

More like this

Google Sheets: Get the Last Row with Any Data Across Multiple Columns

It’s common to have several empty rows at the bottom of a Google Sheet,...

How to Calculate Digital Root in Google Sheets

The digital root is the single-digit value you get by repeatedly summing the digits...

How to Build an Advanced Book Tracker in Google Sheets: Formulas Explained

If you're tired of forgetting what you've read, which books you rated 5 stars,...

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.