+ Reply to Thread
Results 1 to 8 of 8

vlookup and indirect functions

  1. #1
    Registered User
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    2

    vlookup and indirect functions

    I am trying to write a vlookup formula in which the table array is from another file in a different location.I just want to make sure that even if the address of the the file in which table array is defined, is changed it should not effect my formula and it should not ask for the new address. coz there are too many cells containing this formula and I cannot change the address in individual formula. For this what I did was, I copied the address of file [ That contains the table array] into a cell and tried to give the cell reference at vlookup formula using indirect function. But instead of the right value I am getting #ref. My formula goes as follows.

    = vlookup($D5,indirect(A1&"["&"Filename"&"]"&"Sheetname'!$A:$Z"),6,False)

    Where cell A1 contains the address of the file that contains table array. File name is actual name of the file and Sheet name is the name of the sheet name containing table array.

    Can anyone please help me to sort out this issue.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: vlookup and indirect functions

    is the workbook open? indirect only works on open workbooks
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: vlookup and indirect functions

    No. Is there any other way by which I can do this...?

  4. #4
    Forum Contributor codeslizer's Avatar
    Join Date
    05-28-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2003 - 2010
    Posts
    245

    Re: vlookup and indirect functions

    Yes of course. But for that, the file needs to be locally available. If shared path then should be mapped to a network drive. I've tried performing it with "\\170.21.4.3..." kind of links but haven't been successful so far. So, can't guarantee if there's a way for that or not. For this, you'll need the path in three pieces to do a VLOOKUP.

    1. Path without Filename but ending with a backslash. Say B2 stores this path. Then B2 = C:\Users\cOdEsLiZeR\Desktop\
    2. File name. Say C2 stores file name. Then C2 = TestParent
    3. Sheet name and range. Say D2 stores this details then D2 = Sheet1'!$B$2:$C$10
    ** Please note, the single quote after sheet name but its not available before it.

    Then if the referencing value is available in E2, the VLOOKUP formula would come up something like this:
    Please Login or Register  to view this content.
    Here, you must note: the single quote as the first element in CONCATENATE as the path passed is like
    Please Login or Register  to view this content.
    cOdEsLiZeR - Back after a long break.. Let's sLiZe some more cOdEs!!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vlookup and indirect functions

    @Codeslizer, I think the OP is asking is there any way to use INDIRECT() to get a value from a CLOSED workbook. INDIRECT() as you've demonstrated does work if the referenced workbook is open, else it does not.


    Here's a similar thread that provided a VBA solution to accomplish this.


    There's also an ADD-IN on the internet called MOREFUNC that adds 100s of new functions to your Excel, one of which is INDIRECT.EXT(), a replacement for INDIRECT(), and this one is purported to work on closed workbooks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: vlookup and indirect functions

    codeslozer, did you read Martin's post?

    Quote Originally Posted by martindwilson View Post
    is the workbook open? indirect only works on open workbooks
    for it to work on CLOSED workbooks - as the OP said they were doing - they need to install the Morefunc add-in

    edit: is there an echo in here, Jerry? lol
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Contributor codeslizer's Avatar
    Join Date
    05-28-2013
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2003 - 2010
    Posts
    245

    Re: vlookup and indirect functions

    Hey Guys, with all due respect.. I was only trying to share what I experienced. Dunno, for what reason that INDIRECT formula was fetching me the data, I tried looking up for.. .. and yes, I did read Martin's post so I closed the main file and reopened it with making sure the source file with table array is closed. Still the number showed up. Refreshed the formula pressing F2 and Enter. Still gave me the numbers.. Yes, calculations were automatic. So, thought maybe the formula works on closed workbooks too.. :D

    I must say.. things didn't work out now when I tried again in a new workbook.. :p searched and found yeah.. It never works too..!!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: vlookup and indirect functions

    Once the workbook is open, the data will appear. Even if you close the workbook the prior answer may remain, that's proabably just luck. In general, as you've discovered, it does not.

    See post #5 for some alternate avenues you can explore.

+ 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] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Andy Wiggins in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 12:05 PM
  2. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Andy Wiggins in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 04:05 AM
  3. Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  4. Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 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