+ Reply to Thread
Results 1 to 11 of 11

Return Fullpath without filename

  1. #1
    Registered User
    Join Date
    05-17-2011
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Thumbs up Return Fullpath without filename

    Any Excel formula I can use to extract only the folder path (D:\Shares\Admin\110122.CTOM-Annual-Dinner\IMG_0044.jpg) into D:\Shares\Admin\110122.CTOM-Annual-Dinner without the filenames

    I;m trying not to use any Macro.
    Last edited by andywwc; 05-19-2011 at 05:32 AM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    Hi,

    I am guessing that you have a list of filenames already in Excel.

    Second guess is that the file names differ in length.

    Correct me if my assumptions are wrong.

    abousetta

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    Sorry... I should have began with Welcome to the Forum

    abousetta

  4. #4
    Registered User
    Join Date
    05-17-2011
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Return Fullpath without filename

    This is the sample of the data in the Excel spreadsheet.

    D:\Shares\Admin
    D:\Shares\Admin\110122.CTOM-Annual-Dinner
    D:\Shares\Admin\110122.CTOM-Annual-Dinner\IMG_0044.jpg
    D:\Shares\Admin\110122.CTOM-Annual-Dinner\P1000774.JPG
    D:\Shares\Admin\CHEERS Photo\P1010084.JPG
    D:\Shares\Admin\CHEERS Photo\P1010085.JPG
    D:\Shares\Admin\CHEERS Photo\P1010086.JPG
    D:\Shares\Admin\CHEERS Photo\Thumbs.db
    D:\Shares\Admin\CTOM Photos
    D:\Shares\Admin\CTOM Photos\101015.MarkLwinBirthday\MarkLwinBirthday-0007.jpg
    D:\Shares\Admin\CTOM Photos\101015.MarkLwinBirthday\MarkLwinBirthday-0008.jpg
    D:\Shares\Admin\CTOM Photos\101015.MarkLwinBirthday\Thumbs.db
    D:\Shares\Admin\CTOM Photos\101022.Teambuilding\P1000045.JPG
    D:\Shares\Admin\CTOM Photos\101022.Teambuilding\P1000046.JPG

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    Hi,

    OK, here is my first attempt. It seems to be working fine on the list you posted. The original formula was posted by Aladin Akyurek (other options available including a different approach by DonkeyOte).

    I have modified formula to be as follows:

    Please Login or Register  to view this content.
    The attachment may be a little more intuiative.

    Let me know if it works out for you or if you have any scenarios in which is doesn't perform as expected.

    Good luck.

    abousetta
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-17-2011
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Return Fullpath without filename

    Thanks, it's working great. I have modified the code to remove filenames with 4 extension, i.e..docx

    =IF(ISERROR(FIND(".",RIGHT(A2,5))),A2,LEFT(A2,LEN(A2)-(LEN(A2)-SEARCH("@",SUBSTITUTE(A2,"\","@",LEN(A2)-LEN(SUBSTITUTE(A2,"\","")))))))

    From the file, can we show the result of the pathname without the '\' i.e. D:\Shares\Admin\110122.CTOM-Annual-Dinner instead of D:\Shares\Admin\110122.CTOM-Annual-Dinner\
    Last edited by andywwc; 05-18-2011 at 09:35 PM.

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    Hi,

    I thought about that after the post, but since your examples excluded four letter file extensions, then I didn't investigate further. Even so, I think you got the hang of the formula if you were able to modify it.

    As for the second request, let me get back to you in five minutes.. need to test it in real life, but shouldn't be a problem (I think).

    abousetta

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    It looks ugly and it will have to try and see if I can streamline it, but this seems to work fine for the possible scenarios so far:

    Please Login or Register  to view this content.
    Now I am putting all the formulas in one cell because I am assuming that you don't want to use helper cells (columns) and I think you said that you don't want any vba.

    abousetta

  9. #9
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    The attachment demonstrates the differences between the two techniques (one formula - one column vs. two formulas - two columns). Results are the same and the latter is probably easier to maintain, but this is a matter of personal preference.

    abousetta
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-17-2011
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Return Fullpath without filename

    Thanks a lot abousetta!!! You make my day.

    I will stick to the later formula. It saves me a lot of time.

  11. #11
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Return Fullpath without filename

    Glad I could be of assistance.

    If you are satisfied with the results, please mark the thread as [SOLVED] (next to the title on the first post). Also positive recognition (scales) are always welcomed .

    Good luck.

    abousetta

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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