+ Reply to Thread
Results 1 to 9 of 9

VLOOKUP: ignore first 58 characters in cell, return value, export XML

  1. #1
    Registered User
    Join Date
    02-27-2010
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    VLOOKUP: ignore first 58 characters in cell, return value, export XML

    I have 2 spreadsheets:
    1 - list of filenames, title, description
    2 - list of filenames with paths (and additional information)

    Can't figure out how to write the VLOOKUP so it ignores the first 58 characters (which are the path) and matches the filename so I can return the title: description in spreadsheet 2, then export to XML.

    Spreadsheet 2 originated as an XML file so there's that to work with as well if it makes a difference.

    Any help would be greatly appreciated. Thank you!

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    Where would you want Vlookup to ignore the first 58 characters? In the lookup value or the lookup table first column? A data sample might do wonders to help comprehension. One of the good things in this forum is that you can upload files.

    You can upload a file by clicking "Go Advanced" below the Quick Reply box and then the paper clip icon.

  3. #3
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    Hi Teylyn,

    here's your upload. Maybe you can do a better job than I.

    HTML Code: 
    My formula lookup up the last "\" and reads from that point on.

    I've seen other (better) constructions, but I leave it to others to optimize.
    Attached Files Attached Files
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    alternatively try
    =VLOOKUP(TRIM(RIGHT(SUBSTITUTE(A2,"\",REPT(" ",50)),30)),Sheet1!$A$1:$C$4,2,FALSE)
    edit
    of course if you know file path is always 58 char including the final \ then =VLOOKUP(MID(A2,59,255),Sheet1!$A$1:$C$4,2,FALSE)
    Last edited by martindwilson; 02-28-2010 at 08:34 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    I have a feeling that the lookup value is only the file name, but the first column of the lookup table contains the whole path.

    Up to the OP to clarify.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    yes you could be correct hmm then its simply this format
    =VLOOKUP("*"&A2,Sheet2!$A$14:$B$17,2,FALSE) where a2 =filename.xls Sheet2!$A$14:$B$17 =full paths with filename
    as long as the filename contains the file extension .xls .txt,.doc and so on it will find it as there couldnt be instances like that in the file path.
    Last edited by martindwilson; 02-28-2010 at 08:42 AM.

  7. #7
    Registered User
    Join Date
    02-27-2010
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    Thanks for the responses!

    Due to the difference in the file names I can't lookup past the final / unfortunately...it has to match past character 46 (sorry about the 58...was late and my math was broke) and somehow ignore the underscores. I guess I could do a find/replace to remove spaces and replace with underscores to eliminate that issue.

    I've attached the two spreadsheets. Copy of gallery.xlsx is where I was placing the VLOOKUP to return the match from column 2 of the other. Would there be an easy way to return both columns 2 and 3 separated by ": "?
    Attached Files Attached Files

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    can/t see what you need. give an example

  9. #9
    Registered User
    Join Date
    02-27-2010
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VLOOKUP: ignore first 58 characters in cell, return value, export XML

    I placed the VLOOKUP from martindwilson's post in column DO and it worked great! THANK YOU!!!!!

+ Reply to 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