+ Reply to Thread
Results 1 to 10 of 10

Remove file paths

  1. #1
    Registered User
    Join Date
    10-17-2015
    Location
    Dallas, TX
    MS-Off Ver
    2011
    Posts
    4

    Remove file paths

    Good day. Is there a formula to remove file paths from the value of cells? For example,

    C:\My Documents\Document1.doc
    C:\My Pictures\Picture1.jpg
    C:\My Music\Music1.mp3

    I need a formula that will scan the value of a cell and when it encounters a backslash, remove the backslash and everything before it.

    So the above example will result into:

    Document1.doc
    Picture1.jpg
    Music1.mp3

    I am not a programmer so I will not understand any suggestions involving scripts. If there is a formula I can just copy and paste that would be best. Thank you for any suggestions.
    Last edited by basho924; 10-17-2015 at 08:05 PM.

  2. #2
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Remove file paths

    I'm not at my computer but have you tried using the RIGHT() function, counting the characters to to the back slash and only taking what is to the right of it?

  3. #3
    Registered User
    Join Date
    10-17-2015
    Location
    Dallas, TX
    MS-Off Ver
    2011
    Posts
    4

    Re: Remove file paths

    Thanks but I need a formula that will scan a whole column, not just one cell. It would be too time consuming to manually count the characters to the backslash for each cell. I am dealing with hundreds of thousands of cells. I need a formula that can do that automatically.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove file paths

    Hi, welcome to the forum

    Perhaps this...
    A
    B
    1
    C:\My Documents\Document1.doc Document1.doc
    2
    C:\My Pictures\Picture1.jpg Picture1.jpg
    3
    C:\My Music\Music1.mp3 Music1.mp3

    B1=MID(A1,FIND("@",SUBSTITUTE(A1,"\","@",LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))),1)+1,99)
    copied down
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove file paths

    Bash0 Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    http://www.mrexcel.com/forum/excel-q...ile-paths.html

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Remove file paths

    A message to forum cross posters.

    Please read this:
    http://www.excelguru.ca/node/7
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  7. #7
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Remove file paths

    Ford - I came up with something very similar to yours. :/

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Why are my formulas always longer?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Remove file paths

    CW nicely done

  9. #9
    Registered User
    Join Date
    10-17-2015
    Location
    Dallas, TX
    MS-Off Ver
    2011
    Posts
    4

    Thumbs up Re: Remove file paths

    Thanks FDibbins! Works great!

    Sorry for the cross post. Just needed a solution quickly.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Remove file paths

    Data Range
    A
    B
    1
    C:\My Documents\Document1.doc
    Document1.doc
    2
    C:\My Pictures\Picture1.jpg
    Picture1.jpg
    3
    C:\My Music\Music1.mp3
    Music1.mp3


    This formula entered in B1 and copied down:

    =TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",255)),255))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Linked File Paths Change When File is Moved
    By belewfripp in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-06-2013, 12:18 PM
  2. [SOLVED] Dynamic file paths. HELP!
    By christhweatt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-07-2013, 04:22 PM
  3. Export To Inf file & Zip the Files from the given file paths picking every 10 rows
    By vivekhalder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2012, 03:59 AM
  4. Need help with vlookup file paths!
    By LangerXXV in forum Excel General
    Replies: 2
    Last Post: 04-17-2012, 11:56 PM
  5. [SOLVED] excel file paths
    By Jane in forum Excel General
    Replies: 1
    Last Post: 08-17-2006, 12:05 PM
  6. [SOLVED] Using Variables for file paths in QueryTables.Add
    By Zik in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2006, 10:45 AM
  7. [SOLVED] file paths
    By hr in forum Excel General
    Replies: 0
    Last Post: 12-07-2005, 01:10 PM
  8. Relative file paths
    By Jim in forum Excel General
    Replies: 7
    Last Post: 05-24-2005, 07:02 PM

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