Log in


How to count number of lines (line breaks) in a cell in Excel?

This article is talking about counting number of lines within a cell in Excel.

Count number of lines in a cell with formulas

Easily split multiline cell contents into rows or columns in Excel

Kutools for Excel's Split Cells utility helps you easily split cell contents by space, comma, new line or other separators into separated rows or columns in Excel. See screenshot:

Kutools for Excel includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Free Download Now

doc extract text1

Count number of lines in a cell with formulas

The following formulas can help you to count number of lines in a cell.

1. Select a blank cell, enter formula =LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(10),""))+1 into the Formula Bar, and then press the Enter key. See screenshot:

Note: In the formula, A2 is the cell you need to count a number of lines.

2. Keep selecting the resulting cell, then drag the Fill Handle down to get all line numbers of cells as below screenshot shown.


1. For a blank cell, you will get number 1 after applying the above formula.

2. This formula =LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(10),""))+(LEN(A2)>1) can also help you to count a number of lines in a cell but get number 0 of a blank cell.

Related articles:

Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.