Closed Thread
Results 1 to 7 of 7

Extract text prior to line break

  1. #1
    Forum Contributor
    Join Date
    12-03-2009
    Location
    Providence RI
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    260

    Extract text prior to line break

    Hello,

    I am trying to find out how to extract the text prior to a line break. I am trying to find a way to use FIND/LEFT, however, I can not find a way to use FIND in conjunction with a line break....
    Last edited by Dulanic; 05-17-2010 at 02:06 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract text prior to line break

    something like:

    =LEFT(A1,FIND(CHAR(10),A1)-1)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    12-03-2009
    Location
    Providence RI
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    260

    Re: Extract text prior to line break

    Tried that, that just enters a line break instead of searching for one

    Ends up looking like:
    =LEFT(A1,FIND(CHAR(10),A1)-1)
    ,A1)

    And it throws me a formula error.

  4. #4
    Forum Contributor
    Join Date
    12-03-2009
    Location
    Providence RI
    MS-Off Ver
    Excel 2007, Excel 2010
    Posts
    260

    Re: Extract text prior to line break

    Worked now when I typed it out instead of pasting it in the formula bar....dunno what the problem was.

  5. #5
    Registered User
    Join Date
    03-09-2020
    Location
    Florida
    MS-Off Ver
    2016
    Posts
    1

    Re: Extract text prior to line break

    =LEFT(A2, SEARCH((CHAR(10)), a2))

  6. #6
    Registered User
    Join Date
    09-29-2022
    Location
    London
    MS-Off Ver
    365
    Posts
    1

    Re: Extract text prior to line break

    I haven't been able to make the above solutions work for me in my situation. I want to extract a string of text from a cell which has often multiple lines but not always ordered in the same way.

    I am currently using =MID(G2,SEARCH("keAdHocDsc",G2,1)+11,25)

    However, sometimes my string is not 25 characters so i need to be able to have this part of the syntax dynamic. I always want the string in quotes after "keAdHocDsc=" but only up to the next line break after. (I also don't need apostrophes in my results if that helps)

    Example cell contents 1
    keFeeNom='rengte'
    keAdHocDsc='Rent & Legal Protection'
    keOldCode='273F692F-7792-4D34-AD6B-0F65530F91B8'
    keRPSImported={22/05/2021 00:00:00}
    keConvRef='a0cbc52c-4814-4f23-899e-7e0642fc75cb'
    keAltConvRef='c774f982-dead-4465-adaa-f2891b0730f1'
    keRecChgTo={17/10/2022 00:00:00}

    Example cell contents 2
    keAdHocDsc='Monthly Rent & Legal Protection Admin Fee'
    keOldCode='8ACF95F4-54BC-445D-B182-90177C1C8936'
    keRPSImported={22/05/2021 00:00:00}
    keConvRef='a0cbc52c-4814-4f23-899e-7e0642fc75cb'
    keAltConvRef='c774f982-dead-4465-adaa-f2891b0730f1'
    keRecChgTo={27/10/2022 00:00:00}
    keNAltCode='MMUF'

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Extract text prior to line break

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

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