+ Reply to Thread
Results 1 to 14 of 14

How to extract the third line from a cell

  1. #1
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    How to extract the third line from a cell

    Heya,

    I have a column of cells that I wish to extract the third line of each.
    Each cell has multiple lines separated by a paragraph breaks and the text length of each line is variable.

    Example text in A1

    Line1- length of text is variable
    Line 2- Blank paragraph
    Line3 - length of text is variable
    Line 4- Blank paragraph
    Line 5 (length of text is variable)
    Line 6 (length of text is variable)
    Line 7 (length of text is variable)

    I´m looking for a formula/as that allow me to extract line 3 only. Helper columns is not an issue

    Thank you
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  2. #2
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    MA, USA
    MS-Off Ver
    365(PC) V:2412
    Posts
    1,477

    Re: How to extract the third line from a cell

    is there any kind of uniformailty in each line, such as a "." at the end of the line?

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    Is that ALL in 1 cell?

    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    There is no uniformity in each line.
    That is all in 1 cell.

    Lines 2+4 are actual blank paragraphs (as in Alt+Enter)

    I guess the result I was looking for in the example would be: "Line3 - length of text is variable"

    I´m having trouble attaching a file. Seems the "go advanced" forum option is not working properly for me. (?)

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  6. #6
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    The attachment option is not working but it seems I can insert an image. (?)

    Here is the print screen of what I am looking for.
    Attached Images Attached Images
    Last edited by Portuga; 10-19-2016 at 03:57 PM.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    testing upload
    Attached Files Attached Files

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    Upload worked OK for me.

    Make sure you are using the method I suggested, and NOT using the paper-clip option - that 1 doesnt work

  9. #9
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    Ok. I think I got it now. Sorry!!

    It´s been a while since I was a regular forumite
    Attached Files Attached Files

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    Try this...
    =MID(SUBSTITUTE(A2,CHAR(10),"#",2),SEARCH("#",SUBSTITUTE(A2,CHAR(10),"#",2)),999)

  11. #11
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    Quote Originally Posted by FDibbins View Post
    Try this...
    =MID(SUBSTITUTE(A2,CHAR(10),"#",2),SEARCH("#",SUBSTITUTE(A2,CHAR(10),"#",2)),999)
    It works in starting to extract from line 3 only, but it´s getting info from 4, 5 and so on.
    Maybe it´s related to the length of characters (999)?

    But I think that with this as a helper column, it´s possible to extract the result with another formula referencing that as in
    =LEFT(D2;FIND(CHAR(10);D2)-1)

    P.S - How is your formula inserting the # character at the start?

  12. #12
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    There might be a 1 formula solution but yours works well as step 1 and in conjunction with =LEFT(C2;FIND(CHAR(10);C2)-1) will solve my problem.

    Thank you!

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to extract the third line from a cell

    Sorry, missed that you only wanted #3. Try this...
    =LEFT(SUBSTITUTE(MID(A2,SEARCH("#",SUBSTITUTE(A2,CHAR(10),"#",1))+2,999),CHAR(10),"#",1),SEARCH("#",SUBSTITUTE(SUBSTITUTE(MID(A2,SEARCH("#",SUBSTITUTE(A2,CHAR(10),"#",1))+2,999),CHAR(10),"#",1),CHAR(10),"#",1))-1)

  14. #14
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: How to extract the third line from a cell

    Works like a charm! Thank you

+ 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. Extract last word from multiple-line text cell
    By Rhudi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-04-2013, 09:26 PM
  2. [SOLVED] How to extract strings from cell...and add them on new line.
    By SWMagic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-19-2013, 05:39 PM
  3. Extract a line from a table -> Automate
    By Iluvsodah in forum Excel General
    Replies: 4
    Last Post: 09-26-2012, 12:09 PM
  4. Replies: 0
    Last Post: 06-29-2012, 03:16 PM
  5. Extract Line From Comment
    By Vic Schoeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2011, 07:04 AM
  6. Extract data by line color?
    By g48dd in forum Excel General
    Replies: 6
    Last Post: 02-03-2011, 09:38 AM
  7. Trying to extract every third line
    By debbiemc in forum Excel General
    Replies: 4
    Last Post: 03-14-2006, 04:00 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