+ Reply to Thread
Results 1 to 19 of 19

Formula to return contents of a cell using file path and cell coordinates

  1. #1
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Formula to return contents of a cell using file path and cell coordinates

    Is there a formula to look up an excel file with the file pathway, sheet name, and cell number?

    For example, return the contents of cell G55 on Sheet1 in file path P:\Stuff\CUSTOMERS\Customer1\ExcelFile.xlsm.

    The other thing is I put the file path in a cell. In the example above, the file path is in cell P2. So the formula would have to read in cell P2 (the file path), then the sheet name, then the cell and return whatever is in that cell.

    I've tried INDIRECT.EXT and also direct links using "=", but it always asks me to give it the path again, even after I told it the file path.
    Last edited by gaker10; 01-13-2015 at 01:48 PM.

  2. #2
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    Just tried a VLOOKUP with a wildcard and it still asked me for a path:

    =VLOOKUP("*",[P2]SUMMARY!D55,1,0)

    Where P2 contains the excel file path. It might be my syntax.

  3. #3
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    UPDATE: I typed this in manually and it worked. But I would like to automate this necessary syntax into my formula.
    Last edited by gaker10; 01-13-2015 at 02:23 PM.

  4. #4
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    I managed to extract the file name (workbook name) only from the path. Now I need to extract the path without the filename, do a concatenation to put the right syntax in, and then run the formula using the concatenated string (path).

    Formula to extract a workbook file name from a full path: =MID(P2,FIND(CHAR(1),SUBSTITUTE(P2,"\",CHAR(1),
    LEN(P2)-LEN(SUBSTITUTE(P2,"\",""))))+1,LEN(P2))

    Where P2 is the cell where my full path is.

  5. #5
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    In regards to post #4, SUCCESS! The formula to extract parent path ONLY:

    =LEFT(P2,FIND("?",SUBSTITUTE(P2,"\","?",LEN(P2)-LEN(SUBSTITUTE(P2,"\","")))))

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    Hi there. Drag both files to your desktop. open Book 2. Change the bit illustrated in bold, in the actual formulas in Book 2 to suit your circumstances. Check answer in Book1.xlsx.

    Any queries, please shout...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  7. #7
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    None of it was in bold, but I see where you mean. I'm on a network computer at work so I'm not sure this will work for me the same way as it does for you.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    Ha! You're right. All that was in bold was C:\windows8\user\desktop

    I mustn't have saved it before posting...

    I haven't tried using it over a network, but I dont see whay it SHOULDN'T work. At home now, so I can't check it out...

  9. #9
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    I know how to put in the right pathway for this computer, but I'm not sure it will have the same effect as a home PC. Also, dragging the workbooks to my desktop only makes a firefox html format of the workbook, and not the actual workbook, so I need to download them first and then throw them into my desktop.

  10. #10
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    The formulas gave me a #NAME? error. I followed the path exactly as I typed it and I don't know where I went wrong.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    Some others that you may find useful...

    Formula to return file path minus filename
    =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

    Filepath +filename & sheetname
    =CELL("filename",A1)

    Filename only
    =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)


    Sheetname only
    =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99)

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    Yea, I meant for you to download them. What is the filepath to the desktop on the PC that you're currently at?

  13. #13
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    The domain within C: is protected, so I tried another drive and it still did not work. I can't actually give you the path info because it's sensitive. But I'll give you something close: E:\MyFolder\Book1.xlsx. The formula then would be: =INDIRECT.EXT("'E:\MyFolder\[Book1.xlsx]Sheet1'!A$1"). This produces a #NAME? error.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    Mmm.

    Have you seen/tried this?

    http://www.excelforum.com/excel-form...work-path.html

    Martin is very active on this forum. Maybe you should drop him a PM...

  15. #15
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    Tried some of the suggestions on there with no luck. Sent him a PM.

  16. #16
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    I sent him a PM but its not showing up in my Sent Items.

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: Formula to return contents of a cell using file path and cell coordinates

    It's a Form feature, I think. They only save in sent if you specifically ask them to.

  18. #18
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    I will update when I receive a response.

  19. #19
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: Formula to return contents of a cell using file path and cell coordinates

    I did not receive a response, and I accidentally posted a thread with the same subject, totally forgetting about this one.

    The link: http://www.excelforum.com/excel-form...ml#post4018806

+ 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. Ignore file path in cell contents
    By ianarman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-20-2013, 10:40 PM
  2. Replies: 4
    Last Post: 03-19-2012, 03:05 PM
  3. Replies: 1
    Last Post: 03-19-2012, 09:43 AM
  4. Embedding contents of a cell into a file path
    By morris5984 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2009, 01:52 AM
  5. macro to include cell contents b1 in file path
    By martindwilson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2008, 07:42 AM

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