Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting number of lines in a CELL

Hi,

I have a cell which has a number of lines within it. I want the number of lines it has to come into another cell. Is there any formula or macro for that?

Eg:
A1 content is:
first line
second line
thrid line
Once I use the formula/macro, say A2 will have value 3.

Thanks a lot,
fbhcah
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Counting number of lines in a CELL

=LEN(F1)-LEN(SUBSTITUTE(F1,CHAR(10),""))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"fbhcah" wrote in message
...
Hi,

I have a cell which has a number of lines within it. I want the number of

lines it has to come into another cell. Is there any formula or macro for
that?

Eg:
A1 content is:
first line
second line
thrid line
Once I use the formula/macro, say A2 will have value 3.

Thanks a lot,
fbhcah



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Counting number of lines in a CELL

Thanks Bob, slight tweak
=LEN(F1)-LEN(SUBSTITUTE(F1,CHAR(10),"")) <<< is 1 off << showing 8
versus 9

=LEN(F1)-LEN(SUBSTITUTE(F1,CHAR(10),"")) +1 << Last Line does not have
Char(10)

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

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"fbhcah" wrote in message
...
Hi,

I have a cell which has a number of lines within it. I want the number

of
lines it has to come into another cell. Is there any formula or macro for
that?

Eg:
A1 content is:
first line
second line
thrid line
Once I use the formula/macro, say A2 will have value 3.

Thanks a lot,
fbhcah





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Counting number of lines in a CELL

Your formula is "so cool" - I'd give anything to understand what you (and
the other top responders here) do. Tks

"JMay" wrote in message news:kooZb.6674$iB.2484@lakeread06...
Thanks Bob, slight tweak
=LEN(F1)-LEN(SUBSTITUTE(F1,CHAR(10),"")) <<< is 1 off << showing 8
versus 9

=LEN(F1)-LEN(SUBSTITUTE(F1,CHAR(10),"")) +1 << Last Line does not have
Char(10)

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

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"fbhcah" wrote in message
...
Hi,

I have a cell which has a number of lines within it. I want the number

of
lines it has to come into another cell. Is there any formula or macro

for
that?

Eg:
A1 content is:
first line
second line
thrid line
Once I use the formula/macro, say A2 will have value 3.

Thanks a lot,
fbhcah







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
counting number of word in a cell kokhong Excel Discussion (Misc queries) 4 March 9th 10 12:57 PM
Counting number of characters in a cell Still learning Excel Worksheet Functions 4 October 14th 08 01:06 PM
How do I make a cell with vertical lines for number entry? Russ[_5_] Excel Discussion (Misc queries) 4 February 21st 08 03:08 PM
How do I make lines appear after entering a number in a cell? Achilleas Excel Discussion (Misc queries) 2 September 2nd 05 09:21 PM
Counting the number of letters in a cell beefycj5 Excel Discussion (Misc queries) 2 June 1st 05 08:28 PM


All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"