+ Reply to Thread
Results 1 to 8 of 8

3 part text parse: left, mid and right

  1. #1
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    3 part text parse: left, mid and right

    I'm stumped on this three part text parse in a pipe-delimited format. Help greatly appreciated!
    Attached Files Attached Files

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

    Re: 3 part text parse: left, mid and right

    You can use: Data => Text to Columns, or try:

    =TRIM(MID(SUBSTITUTE($A2,"|",REPT(" ",250)),COLUMNS($B$2:B2)*250-249,250))

  3. #3
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: 3 part text parse: left, mid and right

    I apologize for not clarifying that a formula is the best solution in this case because the values are not static. New values are being added constantly from a survey.

    I tried the solution =TRIM(MID(SUBSTITUTE($A4,"|",REPT(" ",250)),COLUMNS($B$2:B4)*250-249,250)) and it appears to return the same data as =IF(ISERROR(LEFT(A2,FIND("|",A2)-1)),A2,LEFT(A2,FIND("|",A2)-1))

    The formula I've tried using for the middle portion between both pipes does not work as intended: =MID(LEFT(A2,FIND("|",A2)-1),FIND("|",A2)+1,LEN(A2))
    The formula I've tried using for the right portion returns everything after the first instead of only data after the last pipe: =IF(ISERROR(MID(A2,FIND("|",A2,1)+1,LEN(A2))),"",MID(A2,FIND("|",A2,1)+1,LEN(A2)))
    Last edited by Seattlites; 08-03-2021 at 09:26 PM.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: 3 part text parse: left, mid and right

    Quote Originally Posted by Seattlites View Post
    I tried the solution =TRIM(MID(SUBSTITUTE($A4,"|",REPT(" ",250)),COLUMNS($B$2:B4)*250-249,250)) and it appears to return the same data as =IF(ISERROR(LEFT(A2,FIND("|",A2)-1)),A2,LEFT(A2,FIND("|",A2)-1))
    It is not clear from your response if you understood that you are supposed to put that formula in your first cell AND THEN copy it across for two more columns, then copy those three cells down to the bottom of your data.

  5. #5
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: 3 part text parse: left, mid and right

    Quote Originally Posted by Rick Rothstein View Post
    It is not clear from your response if you understood that you are supposed to put that formula in your first cell AND THEN copy it across for two more columns, then copy those three cells down to the bottom of your data.
    I have copied the formula across with no results in the MID and RIGHT columns. Apologies if this sounds obtuse, but the solution is not intuitive. Update attached.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: 3 part text parse: left, mid and right

    Are restricted to Excel only? I often think the easiest way to parse delimited text is using Google Sheets and it's built in SPLIT() function.https://www.sheetaki.com/split-funct...google-sheets/
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Registered User
    Join Date
    08-17-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: 3 part text parse: left, mid and right

    Quote Originally Posted by MrShorty View Post
    Are restricted to Excel only? I often think the easiest way to parse delimited text is using Google Sheets and it's built in SPLIT() function.https://www.sheetaki.com/split-funct...google-sheets/
    SPLIT in Google Sheets is actually perfect, thank you MrShorty!

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: 3 part text parse: left, mid and right

    Quote Originally Posted by Seattlites View Post
    I have copied the formula across with no results in the MID and RIGHT columns. Apologies if this sounds obtuse, but the solution is not intuitive. Update attached.
    Well, of course it didn't work for you... you changed the delimiter. In Message #1 you said your delimiter was the pipe symbol (which is what Phuocam used in his formula) but in the file you just enclosed, you show the delimiter to be a plus sign. You cannot just change your conditions and expect solutions based on your original conditions to still work. Here is Phuocam's formula adjusted to use your new delimiter...

    =TRIM(MID(SUBSTITUTE($A2,"+",REPT(" ",250)),COLUMNS($B$2:B2)*250-249,250))

+ 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: 5
    Last Post: 10-27-2015, 06:49 PM
  2. Extract text left and right of character part 2
    By stuartm4h in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-01-2013, 07:12 AM
  3. Macro to Parse Text - Import text to Excel from Multiple Text Files & Folders
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2012, 01:05 AM
  4. Macro: select a part of a text and compare it with a part of another text
    By vladozah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2012, 06:37 AM
  5. Excel 2007 : Parse string value as part of formula?
    By ecksc in forum Excel General
    Replies: 1
    Last Post: 06-14-2012, 08:50 AM
  6. Parse Part of File name and paste into excel
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-15-2010, 06:12 PM
  7. Slect left and right part of text
    By Soniya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2006, 05:55 AM

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