Transform multiple-line cell contents into columns in Excel

Share this content

By David H. Ringstrom, CPA

Sometimes in Excel you may encounter a situation such as that shown in Figure 1, where each cell contains multiple lines of data. It's not a huge task to manually type a few records, but what if you have dozens or hundreds of records in this format? In this article I'll explain some simple techniques that can make quick work of transforming this data into columns.
Figure 1: It can be difficult to convert multiple lines of text in a single cell into columns
Expert Tip: If you want to recreate data similar to what you see in Figure 1, type a line of text in a cell, and then press Alt-Enter to add a new line.
The first step in the process is to use the SUBSTITUTE function to replace the non-printing new line character with another character. You must use a formula, because Excel's Find and Replace feature doesn't allow you to replace non-printing characters such as new lines. In a pinch, you can use Word to carry out such replacements, as shown in Figure 2, but it's easy to use SUBSTITUTE.
Figure 2: Word allows you to find and replace non-printing characters, but Excel doesn't.
The SUBSTITUTE function has four arguments:
·                     text – In this case, text will be a cell that contains new line characters
·                     old_text - Excel's CHAR function can generate the non-printable new line character
·                     new_text – I like to use the | symbol (often referred to as the pipe symbol) as a unique identifier in place of the new line character. This symbol usually appears above the \ key on your keyboard.
·                     instance_num – This is an optional argument that I'll omit in this case because I want to replace all of the new line characters with the pipe symbol. If I put a number here, only that quantity of new line characters would be replaced.
Excel's CHAR function just has a single argument wherein you indicate the number of the character that you want to return. New line characters are number 10, so I'll use CHAR(10) to indicate a new line. Here is a chart of all of the character symbols.
Now I'm ready to enter the formula shown in Figure 2 into cell B1. Click on cell B1, and then double-click the Fill Handle in the lower right-hand corner of the cell to copy the formula down through cell B5. As you can see in Figure 3, the SUBSTITUTE function takes the data from its original display in multiple rows and puts it into a single row, with a | symbol in between data that was on each row.
Figure 3: The SUBSTITUTE function transforms the multi-line data into a single line.
Now select cells B1 through B5, and then press Ctrl-C to copy the range to the clipboard. Right-click on cell B1, choose Paste Special, and then Values. Leave cells B1 through B5 selected, and choose Data, and then Text to Columns.
As shown in Figure 4, choose Delimited, and then click Next. Then, as shown in Figure 5, choose Other, and enter the | symbol. You can clear the checkbox for Tab, or leave it clicked – this won't have any impact if your data doesn't contain tab characters. Click Finish to complete the wizard steps. As you can see in Figure 6, the data is now transformed into columns!
Figure 4: Choose Delimited on the first screen of the Text to Columns wizard.
Figure 5: Choose Other, specify | as the separator, and then click Finish.
Figure 6: Text to columns transformed the data from rows within a single cell into columns.
About the author:
David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.


Please login or register to join the discussion.

thanks for that!

Thanks it is very nice it is all I needed ;)

Copy and paste special as text (not unicode text)..?


In certain instances when you've already used the Text to Columns feature during a given session Excel will automatically parse pasted data into columns, but in general pasting special as text will simply remove any formatting from the pasted data.


Thanks for the tips. And want to know how to transform from multiple columns/row into multiple-line cell contest?

I have the same question...

Bokhari and Aso,

Just noticed your questions. I'll write up this technique soon as a new article that I'll link to here, but in the short answer is if you want to combine cells A1, B1, and C1 into a single multi-line cell, say D1, use this formula:


then turn on Wrap Text for cell D1. Char(10) derives a carriage return, while the ampersand can be used in place of Excel's CONCATENATE function.


Hi ,
Is there any formula to convert the pipe delimited file to columns automatically instead of doing it manually..


It's possible to do by crafting formulas that use the FIND function to locate the positions of the pipe symbol, and then use LEFT, MID, or RIGHT to extract the contents, but the formulas get very involved, very quickly. There is an alternate technique, however, that involves using a data feature in Excel to establish a link to the text file that preserves the parsing settings used by the Text to Columns wizard. I'll write this technique up this week and post a link back to the new article. This technique would allow you to simply choose a new file name and the contents would automatically transform into columns.



This article explains how to automate separating data into columns. Please feel free to let me know if you have any follow-up questions:


there is no formula shown in figure 2... this article is useless... very poorly written in terms of step by steps

Saved my life - 800 line database with three to five lines of name/address info in single cells. Your method worked like a charm. Disagree with commenter below. Article was very well written and should be executable by a moderate to proficient level user

This was incredibly helpful. It saved me hours of editing. THANK YOU!

this is a really cool suggestion! I have been trying to solve a similar problem for quite some time, because I did not realize that I should go around non-printing characters. This suggestion have worked right away on my data, and helped me to save hours!

Thank you so much for the info. this has proved to be such a timesaver for me. Great tip

Thank you. Thank you. Thank you.

I never usually leave comments but this is awesome. Thank you!

Thanks for this type of service it is like teacher for me. So thanks once again.

Thanks a lot! This post is exactly what i needed. Glad that I've discovered it

Thank you. Huge help. Saved me the trouble of fresh downloads

Try this (re-posting from another site from a user called Nick)
Step 1) select the column
Step 2) go into text to column
Step 3) tick other and in the box type 0010 while Holding the Alt key. (it looks as if youve typed nothing, dont worry)
Step 4) hit next and finish

The reason this works is that 0010 is the ASCII code for a line break. (note that the numbers must be typed on a numberpad).
You can also do a find and replace for Alt-0010 and then do the text to column.
Hope that helps.