+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : use a variable in formula for a workbookname

  1. #1
    Registered User
    Join Date
    01-11-2012
    Location
    Leiden, netherlands
    MS-Off Ver
    Excel 2007
    Posts
    1

    use a variable in formula for a workbookname

    Hi,

    I have different workbooks with data.
    eg workbook "data_red". workbook "data_blue" and workbook "data_green". The sheetnames are the same in the different workbooks.

    Now I have a workbook called "Overview". In this workbook I have a formula in cells A10..A110 that is linked to data in workbook "data_blue" (=[Data_blue.xlsx]Sheet1!$A$1 and so on.

    If I want to use the data from the other workbook, eg "data_green.xlsx", I have to change al the formulas in the cells of workbook " Overview".

    What I like to do is to put a variable in the formula =[Data_blue.xlsx]Sheet1!$A$1 on the position of the workbook [Data_blue.xlsx]. So that I have a cell B1 in the Overview workbook where I put the name of one of the other workbooks, eg workbook "data_blue". And that the formula now is changed to get the data from the other workbook.

    Hopefully do you understand what I mean. And do you have a solution for it

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: use a variable in formula for a workbookname

    The INDIRECT function allows for that, but unfortunately, it only works with open workbooks.

    e.g.

    =INDIRECT('"["&$B$1&".xlsx]Sheet1'!$A$1")

    If you can download and install a free addin called Morefunc

    then you can use the INDIRECT.EXT to work with closed workbooks

    =INDIRECT.EXT('"["&$B$1&".xlsx]Sheet1'!$A$1")
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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