# Count Lines in a Cell

## Count Lines in a Range of Excel Worksheet Cells

Count Lines in a Cell or Range of Cell

To count the number of lines in any cell with Wrap Text on, use

=LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),""))+1

Keep in kind that the formula above WILL return 1 for an empty cell, due to +1. Overcome that problem by use of this function;

=LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),""))+(LEN(A1)>1)

The +(LEN(A1)>1) will either return TRUE (1) or FALSE (0).

f more than a single cell, you can repeat the formula for each cell in the range and SUM the results (My preference). Or use a single cell and nest the formula above with a
SUM. E.g

=SUM(LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),""))+(LEN(A1)>1),LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))+(LEN(A2)>1)...etc)

Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over \$64.00. ALL purchases totaling over \$150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.