+ Reply to Thread
Results 1 to 7 of 7

extract file name from path

Hybrid View

  1. #1
    Registered User
    Join Date
    04-04-2011
    Location
    wellington
    MS-Off Ver
    Excel 2003
    Posts
    3

    extract file name from path

    Hi i have a file location in say cell a1 ie. "C:/files/image.jpeg" is it possible to format this or create a formula in a2 to contain just "image.jpeg"
    Last edited by pike; 04-04-2011 at 07:19 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: cell transformation

    Hi d3ad
    Welcome to the forum

    =mid(a1,find("*",substitue(a1,"\","*",len(a1)-len(substitute(a1,"\",))))=1,len(a1))
    Can you please change your thread title to extract file name form path
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    04-04-2011
    Location
    wellington
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract file name from path

    Hi Pike,
    Thanks for the help but i just get the name? error i have tried to reverse engineer the mid and find formula but to no avail. i am running excel on osx but have checked and all the functions (mid, find, substitute are usable on this version) do you have any clues? thanks again for the help!!!!

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: extract file name from path

    Hi d3ad

    I have cahnge the \ to / as in your example
    but it should be \

    so C:/files/image.jpeg becomes image.jpeg

    =MID(A1,FIND("*",SUBSTITUTE(A1,"/","*",LEN(A1)-LEN(SUBSTITUTE(A1,"/",))))+1,LEN(A1))

    plus removed a spelling mistake in substitute

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

    Re: extract file name from path

    =trim(right(substitute(a1,"/",rept(" ",25)),25))
    "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

  6. #6
    Registered User
    Join Date
    04-04-2011
    Location
    wellington
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract file name from path

    fantastic thank you guys VERY much! sorry for my bad spelling in the first place!!!

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: extract file name from path

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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