How do I count rows within a cell?

J

Jouni Kananen

Hi,

I need to count the number of rows within one cell. Values have been input
using Alt+Enter to cut the data on separate rows.

If if helps, I could also count how often ".h" appears in the cell because
the data are C header files...

I'd like to use something built in. I can write a macro of my own if that's
the only option.

BTW, is there a max number of rows a cell can take in?

Thanks in advance,
Jouni
 
B

Bob Phillips

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

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
J

Jouni Kananen

Works perfectly, thanks Bob!

Jouni

Bob Phillips said:
=LEN(H1)-LEN(SUBSTITUTE(H1,CHAR(10),""))+1

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Gord Dibben

Jouni

Cells will hold 32767 characters, but will display only 1024 characters
normally.

The ALT + ENTERS will increase that 1024 limit quite a bit if entered every 100
chars or so.

Also the row height limitation will curtail display if the lines are quite
short.


Gord Dibben MS Excel MVP
 
Top