+ Reply to Thread
Results 1 to 5 of 5

Variable File and Path Names

  1. #1
    Registered User
    Join Date
    04-28-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    28

    Variable File and Path Names

    Hi,

    I'm trying to use the indirect function to reference other files that are defined as variables.

    The formula I have is

    =VLOOKUP("Sales",INDIRECT(file&[Book3.xls]Sheet1!$A$1:$G$7),3,FALSE)

    Where 'File' is the variable name of the path of the file. This is currently set as:

    C:\Documents and Settings\guykn\Desktop\

    This returns #value

    Can anyone help me and tell me what I'm doing wrong!

    THANKS

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Variable File and Path Names

    =VLOOKUP("Sales",INDIRECT(a50&"[Book3.xls]Sheet1!$A$1:$G$7"),3,FALSE)
    where a50 holds the path

  3. #3
    Registered User
    Join Date
    04-28-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Variable File and Path Names

    Hi,

    Thanks for this, it works even though there is no value in A50,

    If I put in the cell ref d1 it falls over and i get the dreaded #ref

    I've tried it both with the other file open and closed

    Any Ideas?

    Guy

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Variable File and Path Names

    If I put in the cell ref d1 it falls over and i get the dreaded #ref
    I don't understand what you mean, did you enter the path in D1and replace A50 with D1 ? This is part of your lookup table ...

  5. #5
    Registered User
    Join Date
    04-28-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Variable File and Path Names

    Hi,

    yes, I replace the A50 with d1 which references the file path C:\Documents and Settings\guykn\Desktop\ and it does not work

    A50 is not doing the lookup as 'Sales' is the first part of the lookup and the indirect part is looking is point to to the table in a particular file

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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