+ Reply to Thread
Results 1 to 10 of 10

VLookup into diffrent worksheets in a diffrent workbook

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    Hertfordshire UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    VLookup into diffrent worksheets in a diffrent workbook

    Hi people,

    I have a problem i hope someone can help with. I have a sheet which has a list of names in a workbook names.xlsm in column B and the following formula in column G:

    =VLOOKUP($G$1,'[Web Data.xlsm]Paul Smith '!$P$1:$AH$102,19,0)

    This works perfectly well however the workbook Web Data.xlsm has almost 100 different worksheets with the names in names.xlsm column B. So i was hoping there was a way not to do this 100 times with all the diffrent names.

    So Paul Smith is B2 in names.xlsm and there is a worksheet in Web Data.xlsm called Paul Smith. The in B3 I have Ben Smith and a worksheet in Web Data.xlsm called Ben Smith. So i was hoping there is a macro or simple way to reference the worksheet in Web Data.xlsm with the information in names.xlsm column B.

  2. #2
    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 into diffrent worksheets in a diffrent workbook

    1) Location: WHYDOYOUNEEDTHIS

    This forum is used worldwide. Having the city/region appear helps us communicate more informatively right out of the box. The versions of Excel have small differences from country to country, and knowing someone your talking to is on the other side of the world might make everyone more patient with long delays.

    Please update your profile to properly display a usable "Location". Obviously, we don't want your address.

    =====================

    2) The function you're looking for is INDIRECT(). Read up on that function in the Excel Help files. It is used to construct an address using pieces of text, then converting the resulting string into a usable link/address for use in a formula.

    Good News - it does exactly what you want.

    Bad News - it does not work for creating links to external workbooks unless those workbooks are open, too. But it works just fine if that external workbook is open.

    Maybe Good News - you can add new functionality into your Excel to give you an additional set of tools, one of which is a replacement function for INDIRECT() that does work on closed external workbooks. This Add-In is called MOREFUNC and the new function would be called INDIRECT.EXT()

    Here's a link to a thread here on the forum discussing this.

    Maybe Bad News - even though it works once installed and in use, if there are a LOT of said formulas, you will most likely start to see performance lag in your workbook.
    _________________
    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!)

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: VLookup into diffrent worksheets in a diffrent workbook

    Quote Originally Posted by JBeaucaire View Post
    Even more bad news...

    None of the links in that thread lead you to the add-in anymore.

    I don't know where you can find it at this time.
    Last edited by Tony Valko; 05-25-2013 at 09:58 AM. Reason: I don't know how to spell
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    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 into diffrent worksheets in a diffrent workbook

    Tony, thanks for that! That reference page has been updated. The new link to d/l page:

    http://www.ashishmathur.com/tag/morefunc/
    Last edited by JBeaucaire; 05-25-2013 at 11:50 AM.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: VLookup into diffrent worksheets in a diffrent workbook

    The author of the morefunc add-in is Laurent Longre, a (former?) MS MVP.

    It's good that Ashish Mathur (another MS MVP) has a working link to the add-in.

  6. #6
    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 into diffrent worksheets in a diffrent workbook

    Hah, shows how much I know.... Updated.

  7. #7
    Registered User
    Join Date
    03-11-2013
    Location
    Hertfordshire UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookup into diffrent worksheets in a diffrent workbook

    Thank you for the advice, however i am unsure how to use it. Do i incorporate the INDIRECT into the VLookup or do i needs to set up arrays in all the 100 odd worksheets then just use the =INDIRECT?

    I am totally confused how to implement the advice in the given formula. I might not have explained what i needed well enough. The second work book is called Web Data the variable is Paul Smith, which is a sheet in the Web Data workbook.

    =VLOOKUP($G$1,'[Web Data.xlsm]Paul Smith '!$P$1:$AH$102,19,0)

    Your help is appreciated.
    Last edited by joffy1979; 05-26-2013 at 06:58 AM.

  8. #8
    Registered User
    Join Date
    03-11-2013
    Location
    Hertfordshire UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: VLookup into diffrent worksheets in a diffrent workbook

    Ok I think i have it

    =VLOOKUP(H1,INDIRECT("'[Web Data.xlsm]"&$B$2&"'!$P$1:$AH$102"),19,0)

    Does this look right? seems to work

  9. #9
    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 into diffrent worksheets in a diffrent workbook

    Yes, that is the correct way to do it if the Web Data.xlsm file is open.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: VLookup into diffrent worksheets in a diffrent workbook

    Quote Originally Posted by joffy1979 View Post
    Ok I think i have it

    =VLOOKUP(H1,INDIRECT("'[Web Data.xlsm]"&$B$2&"'!$P$1:$AH$102"),19,0)

    Does this look right? seems to work
    As JB noted, that will work as long as the source file is open or, if the source file is closed until the file with the formula does a calculation.

    Quoted range/cell references within the INDIRECT function will automatically be evaluated as absolute references so there's no need to include the dollar signs:

    =VLOOKUP(H1,INDIRECT("'[Web Data.xlsm]"&$B$2&"'!P1:AH102"),19,0)

+ 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