Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Splitting Information into Rows.

Splitting Information into Rows

Written by Allen Wyatt (last updated November 8, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


James has some data in a worksheet that is contained in a series of rows. One of the columns in the data includes cells that have multiple lines per cell. (The data in the cell was separated into lines by pressing Alt+Enter between items.) James would like to split this data into multiple rows. For instance, if there were three lines of data in a single cell in the row, then the data in that cell should be split out into three rows.

Excel provides a handy way to split data into separate columns using the Text to Columns tool. This can be used to split the data based on the presence of the ASCII 10 character (linefeed), which is what Excel inserts when you press Alt+Enter. The problem is that while this successfully splits the data into separate columns, it doesn't get it into separate rows, like James requested.

That means that the solution to this problem must include the use of a macro. One approach is shown in the following code. In this example, the macro assumes that you want to "expand" everything in the worksheet, and that the data in the worksheet starts in row 1.

Sub CellSplitter()
    Dim Temp As Variant
    Dim CText As String
    Dim J As Long
    Dim K As Integer
    Dim L As Long
    Dim iColumn As Integer
    Dim lTargetRow As Long
    Dim lNumCols As Long
    Dim lNumRows As Long
    Dim wksSource As Worksheet
    Dim wksNew As Worksheet

    iColumn = 4

    Set wksSource = ActiveSheet
    Set wksNew = Worksheets.Add

    lTargetRow = 0
    With wksSource
        lNumCols = Cells(1,Columns.Count).End(xlToLeft).Column
        lNumRows = Cells(Rows.Count,1).End(xlUp).Row
        For J = 1 To lNumRows
            CText = .Cells(J, iColumn).Value
            Temp = Split(CText, vbLf)
            For K = 0 To UBound(Temp)
                lTargetRow = lTargetRow + 1
                For L = 1 to lNumCols
                    If L <> iColumn Then
                        wksNew.Cells(lTargetRow, L) = .Cells(J, L)
                    Else
                        wksNew.Cells(lTargetRow, L) = Temp(K)
                    End If
                Next L
            Next K
        Next J
    End With
End Sub

Note that in order to run the macro, you will need to specify, using the iColumn variable, the column that contains the cells to be split apart. As written here, the macro splits apart info in the fourth column. In addition, the split-apart versions of the cells are stored in a new worksheet, so that the original worksheet is not affected at all.

There is one thing to keep in mind if you choose to use this macro. If you are working with a workbook that was created in an old version of Excel on the Mac (Excel 2001 or older), then the above won't work. That's because those earlier versions of Excel on the Mac didn't use linefeeds (ASCII 10), but instead used carriage returns (ASCII 13). In that case, you can use the above macro, provided you change the Split function to use vbCr instead of vbLf.

Finally, if the macro doesn't seem to work for you, make sure that the cells in your worksheet actual contain linefeeds (or carriage returns). If you have text wrapping turned on in your cells, then Excel automatically wraps text from line to line within the cell. This does not mean, however, that the cells contain any linefeed (or carriage return) characters. Since they aren't there, the macro cannot break anything out into separate rows.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9396) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Splitting Information into Rows.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Bumping Numbers in a Document

If your documents include words that contain numbers (such as a list of parts numbers) you may need a way to increment ...

Discover More

Expanding Width of All Tables

If you have a lot of tables in your documents, you might want to change the width of all of them. You can take forever ...

Discover More

Date Last Edited

When adding headers or footers to your worksheets, you may want to include the date that the workbook was last edited. ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Converting Forced Text to Numbers

If you have some numbers stored in cells that are formatted as text, you may get some surprises when you try to use those ...

Discover More

Pasting without Updating References

Do you need to paste formulas without updating the references in whatever you are pasting? You can accomplish this, ...

Discover More

Defaulting Input to Negative Values

When entering many negative values in a worksheet, you could save time if you didn't need to enter the minus sign for ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 5 + 2?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.