+ Reply to Thread
Results 1 to 5 of 5

VLOOKUP table on one sheet that references every sheet in workbook

  1. #1
    Registered User
    Join Date
    04-08-2013
    Location
    Virginia, US
    MS-Off Ver
    Excel 2010
    Posts
    2

    VLOOKUP table on one sheet that references every sheet in workbook

    I have a workbook that has about 60 sheets that all have the same format.

    I create a "Master" sheet where I have a row of dates in column A. In column B I want a Vlookup function like this =vlookup($A1,Sheet2!$D$2:$K$140,8,TRUE), In column C a vlookup function like this: ==vlookup($A1,Sheet3!$D$2:$K$140,8,TRUE) and so on for the remaining sheets in the workbook. So after the macro is finished, my master sheet should have about 60 columns.

    I'd rather not have to manually change each sheet name in my vlookup columns. Can anyone think of a macro that could help me out with this?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: VLOOKUP table on one sheet that references every sheet in workbook

    Maybe try:

    =VLOOKUP($A1,INDIRECT("Sheet" & COLUMN(B$1) & "!$D$2:$K$140"),8,TRUE)

    and drag across.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: VLOOKUP table on one sheet that references every sheet in workbook

    Is this resolved?

  4. #4
    Registered User
    Join Date
    04-08-2013
    Location
    Virginia, US
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VLOOKUP table on one sheet that references every sheet in workbook

    Thanks for the quick response,

    Say I have three sheets.

    The first sheet (Master Sheet) is the sheet where I want my vlookup table
    The second and third sheets are called (WTI) and (Brent).

    How would I change the vlookup formula so that I can just simply drag across? I tried your formula and get #N/A in the cells.

  5. #5
    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
    52,939

    Re: VLOOKUP table on one sheet that references every sheet in workbook

    In Trevor's formula...

    =VLOOKUP($A1,INDIRECT("Sheet" & COLUMN(B$1) & "!$D$2:$K$140"),8,TRUE)
    the "sheet" is for referencing your sheet name. So change that to the cell ref for where you have your sheet names stored
    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

+ 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