+ Reply to Thread
Results 1 to 8 of 8

Vlookup for multiple worksheets

  1. #1
    Registered User
    Join Date
    07-04-2013
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007/13
    Posts
    4

    Vlookup for multiple worksheets

    I have about 9 tables of data in separate worksheets that I'd like to collate into one table which contains all the data and updates automatically when new data is entered into the original tables.

    My plan was to use a vlookup function and have a column telling the function which sheet to look in; something like this:

    =vlookup(A1, B1! C1:Z100,2,true)

    Where A1 is the ref number of the row of data, B1 contains the name of the source spreadsheet, and cells C1-Z100 in that source spreadsheet contain the data I'm looking for.

    However, I can't get Excel to recognise a sheet name created using a formula. Is there a way to do this?

    Failing that, is there another way to do what I'm trying to achieve?

    Thanks,

    Tim

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

    Re: Vlookup for multiple worksheets

    Try this...

    =VLOOKUP(A1, INDIRECT("'"&B1&"'!C1:D100"),2)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    07-04-2013
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007/13
    Posts
    4

    Re: Vlookup for multiple worksheets

    Thanks, that's fantastic! Although I'm really not sure how it works.

    A couple of other minor things I can't figure out:
    - I'd like to get blank cells (rather than zeros) where the source cell is blank. Is there a tidier way to do this than a nested IF with the above function twice?
    - is it possible to get each value to have the same formatting as the source cell?

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

    Re: Vlookup for multiple worksheets

    I'd like to get blank cells (rather than zeros) where the source cell is blank. Is there a tidier way to do this than a nested IF with the above function twice?
    What type of data does the formula normally return? Is it text? Numeric? Could be both? Something else?

    is it possible to get each value to have the same formatting as the source cell?
    Not using the formula. A formula can only return a value to a cell, it can't return formatting.

  5. #5
    Registered User
    Join Date
    07-04-2013
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007/13
    Posts
    4

    Re: Vlookup for multiple worksheets

    The data being looked up is numeric, except for 1 or 2 columns. The reason I'd like to get blank cells is so that I can average the data in the main table.

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

    Re: Vlookup for multiple worksheets

    One more question...

    For the lookup formula that returns numbers, is 0 a valid result?

  7. #7
    Registered User
    Join Date
    07-04-2013
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007/13
    Posts
    4

    Re: Vlookup for multiple worksheets

    No, all the results are positive and non-zero.

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

    Re: Vlookup for multiple worksheets

    Ok, if the lookup result is a number:

    =IFERROR(1/(1/VLOOKUP(A1,INDIRECT("'"&B1&"'!C1:D100"),2)),"")

    If the lookup result is text:

    =T(VLOOKUP(A1,INDIRECT("'"&B1&"'!C1:D100"),2))

+ 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