+ Reply to Thread
Results 1 to 6 of 6

Use data from a cell to make a dynamic file path

  1. #1
    Registered User
    Join Date
    11-26-2019
    Location
    Wallingford, CT
    MS-Off Ver
    Office 365
    Posts
    6

    Use data from a cell to make a dynamic file path

    I'm so lost here. I'm trying to make a vlookup path change depending on a date chosen from a dropdown.
    Essentially I have a summary page that calculates sales based on current month, or prior month if you choose the month in the dropdown. I'd like the file path to use the date in the dropdown to "dynamically" fill in the path name.

    My date looks like - Nov-19 (mmm-yy)

    I've tried concat and other ways but nothing is making sense.

    Also it it's probably an important note, the date the vlookup is going to is in a separate workbook.
    The bolded parts are what would need to swap and reference the dropdown text.

    Thanks!

    =IFERROR(SUM(VLOOKUP($A3,'\\FILEPATH\[FILENAME.xlsx]TAB'!$A$3:$AM$6, MATCH($AN$2,'\\FILEPATH\[FILENAME.xlsx]TAB'!$A$2:$AK$2), FALSE)),"0")

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Use data from a cell to make a dynamic file path

    Welcome to the Forum JonesIndiana!

    The way to make a dynamic path is by using the function INDIRECT. However, if you do that, it will return an error unless the target file is open. Will the file be open?

    Here is how you would do it. Replace Z9 with the cell containing the dropdown.

    =IFERROR(SUM(VLOOKUP($A3,INDIRECT("'\\FILEPATH\[FILENAME.xlsx]" & TEXT(Z9,"mmm-yy") & "'!$A$3:$AM$6"), MATCH($AN$2,INDIRECT("'\\FILEPATH\[FILENAME.xlsx]" & TEXT(Z9, "mmm-yy") & "'!$A$2:$AK$2")), FALSE)),"0")

    If not, another approach would be to use VBA to create the formula whenever the dropdown changes.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-26-2019
    Location
    Wallingford, CT
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Use data from a cell to make a dynamic file path

    Thanks 6StringJazzer, I'll give that a shot! I can leave the file open if need be.

  4. #4
    Registered User
    Join Date
    11-26-2019
    Location
    Wallingford, CT
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Use data from a cell to make a dynamic file path

    that worked perfect, thank you again 6SJ!

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Use data from a cell to make a dynamic file path

    I'm glad to hear it worked--I typed it straight into the posting without testing it.

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon addreputationiconsmall.jpg below their name.

  6. #6
    Registered User
    Join Date
    11-26-2019
    Location
    Wallingford, CT
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Use data from a cell to make a dynamic file path

    Quote Originally Posted by 6StringJazzer View Post
    I'm glad to hear it worked--I typed it straight into the posting without testing it.

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon Attachment 651612 below their name.
    Will do, thank you again!

+ 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] Dynamic File path for OneDrive
    By Remotruker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2019, 04:54 PM
  2. Create PDF with dynamic file path
    By dark_prince69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2018, 12:19 PM
  3. [SOLVED] Using dynamic file path instead of hard-coded
    By robbo1172 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-20-2018, 08:58 AM
  4. [SOLVED] Referencing File Path - Dynamic Cell Input for Worksheet
    By Chomie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-23-2013, 04:38 PM
  5. Macro to save sheet as CSV using a dynamic file name and file path
    By chris.tinta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 10:45 AM
  6. Dynamic file path
    By GaidenFocus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2011, 12:57 PM
  7. Dynamic path for a file used in the vbscript
    By mosu90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2008, 04:24 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