ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I count rows within a cell? (https://www.excelbanter.com/excel-worksheet-functions/115825-how-do-i-count-rows-within-cell.html)

Jouni Kananen

How do I count rows within a cell?
 
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



Bob Phillips

How do I count rows within a cell?
 
=LEN(H1)-LEN(SUBSTITUTE(H1,CHAR(10),""))+1

--
HTH

Bob Phillips

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

"Jouni Kananen" wrote in message
...
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





Jouni Kananen

How do I count rows within a cell?
 
Works perfectly, thanks Bob!

Jouni

"Bob Phillips" wrote in message
...
=LEN(H1)-LEN(SUBSTITUTE(H1,CHAR(10),""))+1

--
HTH

Bob Phillips

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

"Jouni Kananen" wrote in message
...
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







Gord Dibben

How do I count rows within a cell?
 
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



On Tue, 24 Oct 2006 12:52:49 GMT, "Jouni Kananen"
wrote:

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




All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com