+ Reply to Thread
Results 1 to 3 of 3

Query: Complete file path link using text value of a cell

  1. #1
    Registered User
    Join Date
    10-27-2022
    Location
    Brighton, England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2207 Build 16.0.15427.20248) 64-bit
    Posts
    2

    Query: Complete file path link using text value of a cell

    I am working with user data that is stored in identical workbooks (i.e. the data needed is in the same cell location for each user, on their respective workbook), in folders that all match name and format. I am looking to collate data from multiple users, and create a solution that allows for new users to be regularly added/removed without manually adjusting file paths.

    e.g. The data for user 'Ben' will be in ='S:\Staff\Ben\Timesheets\[Week 85.xlsx]Time Sheet'!$G$17
    and the same document for 'Lisa' will be in ='S:\Staff\Lisa\Timesheets\[Week 85.xlsx]Time Sheet'!$G$17
    as you can see, the only difference in the path is the staff member's name, and this is true for all workbooks I'm looking to collate.

    If I am looking to collate this data, I'm hoping that I can have a formula where Excel autocompletes the path name using a list of staff names.
    e.g. If I put the name 'James' in cell B5, I could use a formula such as ='S:\Staff\(=B5)\Timesheets\[Week 85.xlsx]Time Sheet'!$G$17 However this example formula does not work. Is there a formula that would work?

    I'm attempting this solution as staff are regularly added and removed, and I would like to avoid having to 're-link' this data for each new user, when an automatic solution can be implemented from a list of staff names.

    Many thanks.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Query: Complete file path link using text value of a cell

    Welcome to the forum.

    You can do this:

    =INDIRECT("'S:\Staff"&A1&"\Timesheets\[Week 85.xlsx]Time Sheet'!$G$17")

    where A1 contains the staff name.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-27-2022
    Location
    Brighton, England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2207 Build 16.0.15427.20248) 64-bit
    Posts
    2

    Re: Query: Complete file path link using text value of a cell

    Wow, thank you for the speedy response!
    So following your advice I tried =INDIRECT("'S:\Staff"&A1&"\Timesheets\[Week 85.xlsx]Time Sheet'!$G$17") and kept getting a #REF! error - I hadn't realised that INDIRECT requires the target workbook to be open.

    Once opened it worked perfectly (thank you again) however it means I'll have to manually open all individual workbooks, which won't save any time over adding filepaths manually. I shall persevere to find another way.

    and thank you for the welcome, I'm very impressed with this forum

+ 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] Importing a text file by vba referring to a cell for file name & file path
    By Vivek2705 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-01-2017, 08:54 AM
  2. How to show the complete path of the current excel file ?
    By woshichuanqilz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2017, 11:12 AM
  3. [SOLVED] Separate complete path to file and directory path
    By drgkt in forum Excel General
    Replies: 19
    Last Post: 10-28-2016, 04:17 PM
  4. [SOLVED] Provide Complete Path of File List
    By Tellm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2015, 09:25 AM
  5. [SOLVED] How to link cell reference as path to import text file
    By yogi_himalayan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2014, 10:49 PM
  6. VBA Open Text File <Missing Link> Query Table + Extras
    By duncanm82 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2012, 04:56 PM
  7. Replies: 1
    Last Post: 06-01-2011, 03:30 AM

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