+ Reply to Thread
Results 1 to 5 of 5

Last line of a cell

  1. #1
    Forum Contributor
    Join Date
    03-08-2011
    Location
    Lubbock, TX, USA
    MS-Off Ver
    MS OFFICE 365 EXCEL, OUTLOOK, WORD, POWERPOINT
    Posts
    194

    Last line of a cell

    Since you can force a break with alt-enter in a cell; what would be the easiest way to capture the last line of that cell for use in a "summary" sheet.

    Example: Cell F1 is NOTES and in F2 we find --

    ISSUE IDENTIFIED 9/19/17
    NOT DONE AS OF 9/28/17
    NOT DONE / MESSAGE TO OWNER 10/05/17
    ISSUE NOT DONE 2ND MESSAGE TO OWNER 10/13/17
    INSPECTION SCHEDULED 10/24/17

    The summary sheet would like to capture the last line which in the above example would be "INSPECTION SCHEDULED 10/24/17".

    The reason it is all one cell is that the row uses an equipment id number and other unique items and dedicating an entire row to duplicate everything except the last row of a single cell would make for a huge worksheet. I've tried the obvious =right() function. But I cannot settle on a string length that consistently captures ONLY the last row of the cell. The only certainty is that the date entered will be the last item on each line.

    Thanks for reading.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Last line of a cell

    Try this.

    =MID(F2,SEARCH("^^",SUBSTITUTE(F2,CHAR(10),"^^",LEN(F2)-LEN(SUBSTITUTE(F2,CHAR(10),"")))),LEN(F2))
    If posting code please use code tags, see here.

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,913

    Re: Last line of a cell

    Or try this ...

    =TRIM(RIGHT(SUBSTITUTE(F2,CHAR(10),REPT(" ",LEN(F2))),LEN(F2)))

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Last line of a cell

    Or
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v F
    1
    2 ISSUE IDENTIFIED 9/19/17
    NOT DONE AS OF 9/28/17
    NOT DONE / MESSAGE TO OWNER 10/05/17
    ISSUE NOT DONE 2ND MESSAGE TO OWNER 10/13/17
    INSPECTION SCHEDULED 10/24/17
    3 INSPECTION SCHEDULED 10/24/17
    4
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Contributor
    Join Date
    03-08-2011
    Location
    Lubbock, TX, USA
    MS-Off Ver
    MS OFFICE 365 EXCEL, OUTLOOK, WORD, POWERPOINT
    Posts
    194

    Re: Last line of a cell

    All of these hit the spot thank you to each of you. Problem solved.

    I've never seen "^^" used in a formula before and I'm sort of fuzzy on the LEN and SUBSTITUTE functions. So, I am going to have to try to learn them well enough to apply them on my own.
    Ditto the REPT function.
    Looks like I have some homework.
    Many thanks.


    Quote Originally Posted by Norie View Post
    Try this.

    =MID(F2,SEARCH("^^",SUBSTITUTE(F2,CHAR(10),"^^",LEN(F2)-LEN(SUBSTITUTE(F2,CHAR(10),"")))),LEN(F2))
    Quote Originally Posted by Phuocam View Post
    Or try this ...

    =TRIM(RIGHT(SUBSTITUTE(F2,CHAR(10),REPT(" ",LEN(F2))),LEN(F2)))
    Quote Originally Posted by AlKey View Post
    Or
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v F
    1
    2 ISSUE IDENTIFIED 9/19/17
    NOT DONE AS OF 9/28/17
    NOT DONE / MESSAGE TO OWNER 10/05/17
    ISSUE NOT DONE 2ND MESSAGE TO OWNER 10/13/17
    INSPECTION SCHEDULED 10/24/17
    3 INSPECTION SCHEDULED 10/24/17
    4
    Last edited by Mr_Phil; 10-19-2017 at 02:32 PM. Reason: fat fingers on a small keyboard

+ 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. Replies: 4
    Last Post: 05-20-2020, 02:23 PM
  2. adding line breaks in cell, keeping words on same line
    By beba420 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2017, 07:45 PM
  3. [SOLVED] Macro Assistance - inserting cell & data line by line not by column
    By Toxicca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2015, 09:26 AM
  4. Read the text in a single cell line by line.
    By moon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2010, 06:23 AM
  5. copy line to another line when data is recorded in a cell
    By alestra in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-05-2009, 09:47 PM
  6. Macro to email contents of cell line by line
    By drew_f_taylor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2007, 06:48 AM
  7. Replies: 6
    Last Post: 07-12-2005, 04: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