+ Reply to Thread
Results 1 to 6 of 6

variable file reference

  1. #1
    Registered User
    Join Date
    09-07-2007
    Posts
    43

    variable file reference

    Hi,

    I have a file that needs to be created on a monthly basis, which contains the same information. So, there are a bunch of these excel files in the exact same format, only with different data. I then have another file ("File A") that references these files (ex: "File B", "File C", "File D", etc.) and pulls out the values and manipulates them in different ways, but I was trying to figure out a good way to streamline the process so that all the links in File A don't have to be updated all the time. The problem with using the Edit-->Links function, is that if I edit a link, it will change the data in File A. I simply want to add to the spreadsheet every month (so it basically keeps a monthly record) with the new File E that is created. I was thinking about creating a cell that allows the user to input the current name of the file being referenced, and then using that cell as the source for the name of the file to begin the cell reference code. That, however, doesn't seem to work, because I guess I can't add a specific cell reference (ex: C6) from File B, to the end of the file name, when the file name is itself a cell reference in File A. I hope it isn't too confusing...I tried to make it as understandable as possible. Thanks!

  2. #2
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    INDIRECT function should work for you.

    Simple example of using it is if you enter file name to be referenced in A1 then you can pull data like this.

    =INDIRECT("["&A1&".xls"&"]"&"Sheet1!$B$1")

    This will return you data from Sheet1!B1 of file which name you have entered in A1.

    Hope this will help you understand.

  3. #3
    Registered User
    Join Date
    09-07-2007
    Posts
    43

    thanks

    Thanks! I have another question...say I wanted to return the cell location through some sort of vlookup kind of function instead of the $B$1 part of the formula you gave. Is that possible?

  4. #4
    Forum Contributor
    Join Date
    03-14-2006
    Location
    Pakistan
    Posts
    1,791

    Lightbulb

    Can you explain it with some sample data.

  5. #5
    Registered User
    Join Date
    09-07-2007
    Posts
    43
    say for example that A1 had the word "US" in it, and B1 had "2.5" in it. If i did a vlookup:

    =vlookup("US",A1:C5,2,)

    then it would return 2.5, but what if I wanted it to return "B1" instead. Is that possible?

  6. #6
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Use MATCH

    VLOOKUP and HLOOKUP are the obvious lookup options, however MATCH is often more versatile.

    for your problem link MATCH with the ADDRESS function as follows:

    =ADDRESS(MATCH("US",A1:A5,0),2)

    this will return the string "$B$1" (for your example).

    Mark.

+ 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