+ Reply to Thread
Results 1 to 6 of 6

Extracting a Substring Between Second and Third Delimiters

  1. #1
    Registered User
    Join Date
    08-16-2013
    Location
    Round Rock, Texas
    MS-Off Ver
    Excel 2013
    Posts
    9

    Extracting a Substring Between Second and Third Delimiters

    In column A of an Excel spreadsheet I have a series of file-path strings always in this format: C:\FolderNm1\FolderNm2\FileNm

    I need a formula that will extract the FolderNm2 substring in to column B

    The string will always be between the 2nd and 3rd delimiter ' \ ' , but will vary in length and characters; in may also contain spaces and other special characters

    I did search the forums and didn't find an example I could follow and modify to my needs (I am an Excel novice - or whatever is less than that)

    Any assistance is greatly appreciated and thank you in adavance

    MG

  2. #2
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Extracting a Substring Between Second and Third Delimiters

    =trim(mid(substitute(a2,"\",rept(" ",100)),200,100))
    If you are http://www.excelforum.com/image.php?type=sigpic&userid=125481&dateline=1392355029happy with the results, please add to the contributor's
    reputation by clicking the reputation icon (star icon).




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    http://www.excelaris.co.uk

  3. #3
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Extracting a Substring Between Second and Third Delimiters

    Robert's post is much simpler than the one I had intended
    Last edited by tony h; 09-18-2013 at 05:41 PM.


    click on the * Add Reputation if this was useful or entertaining.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Extracting a Substring Between Second and Third Delimiters

    =MID(B1,FIND("\",B1,FIND("\",B1)+1)+1,FIND("\",B1,FIND("\",B1,FIND("\",B1)+1)+1)-(FIND("\",B1,FIND("\",B1)+1)+1))

    Formula Logic:

    =find("\",B1) - location of first "\"

    =find("\",b1,find("\",B1)+1)) - location of second "\"

    =find("\",b1,find("\",b1,find("\",B1)+1)) - location of third "\"

    =MID(what text,starting at what character,go for how many characters)

    =MID(B1,location of second "\" + 1,location of third "\" - (location of second "\" +1))

    =MID(B1,FIND("\",B1,FIND("\",B1)+1)+1,FIND("\",B1,FIND("\",B1,FIND("\",B1)+1)+1)-(FIND("\",B1,FIND("\",B1)+1)+1))

    =MID(B1,12+1,22-(12+1))

    =MID(B1,13th character, go on for 9 characters)

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Extracting a Substring Between Second and Third Delimiters

    Quote Originally Posted by tony h View Post
    Robert's post is much simpler than the one I had intended
    For reals..

  6. #6
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Extracting a Substring Between Second and Third Delimiters

    Quote Originally Posted by daffodil11 View Post
    For reals..
    That was the way I was going but I did think TextToColumns off the Data tab might do the job for them

+ 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. Extracting substring function VBA
    By friko16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2013, 06:04 PM
  2. Search substring within range, report the substring found
    By Brooke1578 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2012, 03:56 PM
  3. [SOLVED] Extract Substring, then Ignore that Substring, while collecting data from Other substrings
    By Sameki121 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2012, 05:21 PM
  4. Extracting Substring from Column of Data
    By Narmerguy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2011, 10:34 PM
  5. Referencing Delimiters
    By Impartial Derivative in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2011, 12:07 AM

Tags for this Thread

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