Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: LEFT() for each rows in a single cell?

  1. #11
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    6,853
    Post Thanks / Like
    Mentioned
    83 Post(s)
    Tagged
    15 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Quote Originally Posted by jeffcoleky View Post
    So no easy formula method in excel either? If not, thanks everyone for making it work this way! it saves me hours.
    This may be an option to extract a phone in a cell with a formula.
    Copy the formula to the right to extract one phone at a time.

     ABCDEF
    2(734) 435-8519 < Sent TXT 14/25/09 @ 08:54
    (734) 917-1416 < Sent TXT 14/25/09 @ 08:55
    (734) 742-6437 < Sent TXT 14/25/09 @ 08:56
    (734) 435-8511 < Sent TXT 14/25/09 @ 08:57-Bob's number
    (734) 360-5106 < Sent TXT 14/25/09 @ 08:58
    (734) 435-8519(734) 917-1416(734) 742-6437(734) 435-8511(734) 360-5106

    CellFormula
    B2=TRIM(MID(SUBSTITUTE(SUBSTITUTE(" " & $A2," < ",REPT(" ",250)),"(",REPT(" ",250)&"("),(250*((COLUMNS($B$1:B1)*2)-1)),250))
    Last edited by DanteAmor; Oct 22nd, 2019 at 05:44 PM.
    Regards Dante Amor

  2. #12
    Board Regular
    Join Date
    May 2011
    Posts
    274
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Quote Originally Posted by mohadin View Post
    Hi
    What about
    Code:
    B1=LEFT(A1,LEN(A1)-LEN(RIGHT(A1,LEN(MID(A1,FIND("<",A1),255))))-1)
    Although, we could use a 2-step process. If there was a way to turn the original data into individual rows first, then use the formula and back into a single cell? (two formulas using two Columns of cells, not using text to columns)
    Last edited by jeffcoleky; Oct 22nd, 2019 at 05:51 PM.

  3. #13
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,185
    Post Thanks / Like
    Mentioned
    62 Post(s)
    Tagged
    6 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    In Google sheets this works.

    =REGEXREPLACE(A1&CHAR(10),"<.*\n",CHAR(10))
    If posting code please use code tags.

  4. #14
    Board Regular
    Join Date
    May 2011
    Posts
    274
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Quote Originally Posted by Norie View Post
    In Google sheets this works.

    =REGEXREPLACE(A1&CHAR(10),"<.*\n",CHAR(10))
    Woohoo! that works. thanks everyone.

  5. #15
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    41,359
    Post Thanks / Like
    Mentioned
    100 Post(s)
    Tagged
    21 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    If you did want to stick with Excel, there is a manual process you could follow. It takes a bit for me to write out but is a fairly quick process to do.

    1. Copy the date to a new column
    2. Select the column by clicking its heading label
    3. Invoke Find/Replace (Ctrl+H is one way)
    4. In the Find what: box type a space followed by a < sign followed by an * then press Ctrl+J (you won't see the Ctrl+J but that is for the line-feed character)
    5. Put your cursor in the Replace with: box and do another Ctrl+J
    6. In Options>> make sure 'Match entire cell contents' is not checked
    7. Replace All then OK
    8. With the column still selected and the Find/Replace still open put your cursor immediately after the * and press Delete (to remove the invisible line-feed character)
    9. Put your cursor in the Replace with: box and press delete again to remove that line-feed character
    10. Replace All, OK
    Last edited by Peter_SSs; Oct 23rd, 2019 at 02:03 AM.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  6. #16
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    41,359
    Post Thanks / Like
    Mentioned
    100 Post(s)
    Tagged
    21 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Also possible with worksheet functions in Excel if you have the TEXTJOIN function in your version.
    Here I have assumed that all your phone numbers are in identical format (since that is what your sample was) but if not and you wanted to pursue the Excel option, it could be adapted for varying formats.
    This is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.

    Phone Numbers

    AB
    1(734) 435-8519 < Sent TXT 14/25/09 @ 08:54
    (734) 917-1416 < Sent TXT 14/25/09 @ 08:54
    (734) 742-6437 < Sent TXT 14/25/09 @ 08:54
    (734) 435-8511 < Sent TXT 14/25/09 @ 08:54-Bob's number
    (734) 360-5106 < Sent TXT 14/25/09 @ 08:54
    (734) 880-3306 < Sent TXT 14/25/09 @ 08:54
    (734) 384-0869 < Sent TXT 14/25/09 @ 08:54-Not working
    (734) 494-5151 < Sent TXT 14/25/09 @ 08:54
    (435) 851-8519 < Sent TXT 14/25/09 @ 08:54-Yelled at me
    (734) 408-2349 < Sent TXT 14/25/09 @ 08:54
    (734) 224-7269 < Sent TXT 14/25/09 @ 08:54
    (734) 299-4730 < Sent TXT 14/25/09 @ 09:02
    (734) 299-4703 < Sent TXT 14/25/09 @ 09:02-Not working#
    (734) 291-9930 < Sent TXT 14/25/09 @ 09:02
    (734) 345-8002 < Sent TXT 14/25/09 @ 09:02
    (734) 435-8519
    (734) 917-1416
    (734) 742-6437
    (734) 435-8511
    (734) 360-5106
    (734) 880-3306
    (734) 384-0869
    (734) 494-5151
    (435) 851-8519
    (734) 408-2349
    (734) 224-7269
    (734) 299-4730
    (734) 299-4703
    (734) 291-9930
    (734) 345-8002

    Spreadsheet Formulas
    CellFormula
    B1{=TEXTJOIN(CHAR(10),1,LEFT(TRIM(MID(SUBSTITUTE(A1,CHAR(10),REPT(" ",1000)),ROW(INDEX(A:A,1):INDEX(A:A,LEN(A1)))*1000-999,1000)),14))}
    Formula Array:
    Produce enclosing
    { } by entering
    formula with CTRL+SHIFT+ENTER!


    Excel tables to the web >> Excel Jeanie HTML 4
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  7. #17
    Board Regular
    Join Date
    May 2011
    Posts
    274
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Thank you as well!

    Quote Originally Posted by Peter_SSs View Post
    If you did want to stick with Excel, there is a manual process you could follow. It takes a bit for me to write out but is a fairly quick process to do.

    1. Copy the date to a new column
    2. Select the column by clicking its heading label
    3. Invoke Find/Replace (Ctrl+H is one way)
    4. In the Find what: box type a space followed by a < sign followed by an * then press Ctrl+J (you won't see the Ctrl+J but that is for the line-feed character)
    5. Put your cursor in the Replace with: box and do another Ctrl+J
    6. In Options>> make sure 'Match entire cell contents' is not checked
    7. Replace All then OK
    8. With the column still selected and the Find/Replace still open put your cursor immediately after the * and press Delete (to remove the invisible line-feed character)
    9. Put your cursor in the Replace with: box and press delete again to remove that line-feed character
    10. Replace All, OK

  8. #18
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    41,359
    Post Thanks / Like
    Mentioned
    100 Post(s)
    Tagged
    21 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Quote Originally Posted by jeffcoleky View Post
    Thank you as well!
    You're welcome.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

  9. #19
    Board Regular
    Join Date
    Jan 2007
    Posts
    1,214
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    I don't know if this helps you, but if you have the "CONCAT" function (Office 365 of Excel 2019), you could put the initial data in alternate rows starting at A1 and then use a helper column in B1 "=IF(ISBLANK(A1),"=char(10)",LEFT(A1,14))", copied down. Then use the formula "=CONCAT(B1:B31)" and format the cell to wrap.

  10. #20
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    41,359
    Post Thanks / Like
    Mentioned
    100 Post(s)
    Tagged
    21 Thread(s)

    Default Re: LEFT() for each rows in a single cell?

    Quote Originally Posted by Giordano Bruno View Post
    ... if you have the "CONCAT" function ... you could put the initial data in alternate rows starting at A1 and then use a helper column
    If the CONCAT function is available, then so is TEXTJOIN and the result can be obtained without any rearrangement of the original data or helper cells as per post 16.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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