+ Reply to Thread
Results 1 to 3 of 3

Return filepath/name only to a cell

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    15

    Return filepath/name only to a cell

    Hello, I'm trying to return the active path and filename in a cell: C:\Foldername\Filename.xlsm ..

    If I use formula: =cell('filename"), it returns C:\Foldername[Filename.xlsm]SheetName

    I don't want the sheetname, nor the filename in brackets, so I found the following formula that replaces the brackets, but it gets rid of both the filename and sheetname, leaving only the path: =LEFT(K1,FIND("|",SUBSTITUTE(K1,"\","|",LEN(K1)-LEN(SUBSTITUTE(K1,"\","")))))

    I was able to go into Options and add filepath to the quick access bar.. If there is a way to reference it in a cell, that would work as well.

    Any ideas? Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Return filepath/name only to a cell

    =SUBSTITUTE( LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1),"[","")

    this will return what you want/need

    Here is what is returned
    C:\Users\025\Desktop\[sampleconditions.xlsx]Dashboard Your formula
    C:\Users\025\Desktop\sampleconditions.xlsx New Formula

  3. #3
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Return filepath/name only to a cell

    Perfect! Thanks so much!

+ 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. [SOLVED] Return Function as a String to dictate filepath of email attachment
    By JobsSteve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2020, 05:06 AM
  2. Use cell range containing doc rather that filepath
    By Sc0tt1e in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-13-2014, 03:43 PM
  3. [SOLVED] Update filepath in a cell with VBA
    By MissDB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-26-2014, 08:01 AM
  4. [SOLVED] Trying to get the filepath on "Open", but get filepath of a temporary file instead
    By ianpwilliams in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-22-2013, 12:27 AM
  5. [SOLVED] Copying files from a selected filepath to a filepath mentioned in a worksheet's cell
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2012, 03:59 PM
  6. [SOLVED] Copying filepath onto a cell
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-01-2012, 11:43 AM
  7. Filepath in cell problem.
    By Gus80 in forum Excel General
    Replies: 2
    Last Post: 03-31-2010, 07:36 PM

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