+ Reply to Thread
Results 1 to 5 of 5

Count line break in a cell and return the number of line that match with criteria

  1. #1
    Registered User
    Join Date
    01-28-2016
    Location
    indonesia
    MS-Off Ver
    2007
    Posts
    5

    Count line break in a cell and return the number of line that match with criteria

    Hi Everyone

    I really need help about this case:
    Capture1.PNG

    as image above, how to return the number of line that contain word "Dimension". in this case the line number is 6.

    open for VBA but if can please with a formula.

    Regards

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Count line break in a cell and return the number of line that match with criteria

    Try

    =SEARCH("dimension",A2)-SEARCH("dimension",SUBSTITUTE(A2,CHAR(10),""))+1

  3. #3
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Count line break in a cell and return the number of line that match with criteria

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

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Count line break in a cell and return the number of line that match with criteria

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

    where A1 is original string
    and B1 is search sttrng
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Registered User
    Join Date
    01-28-2016
    Location
    indonesia
    MS-Off Ver
    2007
    Posts
    5

    Re: Count line break in a cell and return the number of line that match with criteria

    you all are ROCKS guys!!!

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code to insert line break within a cell if specific criteria is met.
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2018, 09:28 AM
  2. Replies: 12
    Last Post: 06-22-2016, 01:11 PM
  3. [SOLVED] Count only data within a line break (alt-enter) with specific criteria in adjacent column
    By jparve3283 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-20-2016, 10:44 AM
  4. Replies: 5
    Last Post: 10-19-2011, 12:27 PM
  5. [SOLVED] line break / hard return?
    By jd in forum Excel General
    Replies: 3
    Last Post: 02-13-2006, 03:10 AM
  6. line break / hard return?
    By jd in forum Excel General
    Replies: 3
    Last Post: 02-12-2006, 07:40 PM
  7. Replies: 2
    Last Post: 06-14-2005, 02:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1