+ Reply to Thread
Results 1 to 12 of 12

Dynamic Vlookup Formula to get information from different worksheets

  1. #1
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Dynamic Vlookup Formula to get information from different worksheets

    In the attached workbook, I am trying to use a vlookup formula to have information for different clients appear in the Service Invoice sheet depending on client name selected in cell a10 (validation list). I am familiar with using the vlookup formula and can get it to work by manually changing the name of the worksheet in the formula, but how do I set it up so as not to have to change client name manually?

    I want to be able to select a client in cell A10 and have the information from that clients worksheet appear in invoice.

    I hope that is clear.

    Thank you for your time and assistance,

    Regards,

    BigDawg15
    Attached Files Attached Files

  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: Dynamic Vlookup Formula to get information from different worksheets

    =vlookup($a$10,indirect("'"&$a$10&"'!$a2:$h$10"),6,false)
    or in b16 draggable across and down
    =VLOOKUP($A$10,INDIRECT("'"&$A$10&"'!$A"&ROWS($A$1:$A2)&":$H$10"),COLUMNS($A$1:F$1),FALSE)
    Last edited by martindwilson; 12-07-2013 at 03:30 PM.
    "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
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Dynamic Vlookup Formula to get information from different worksheets

    Column references within the ROW(S) functions are irrelevant and don't need to be made absolute.

    ROWS(A$1:A2)

    Likewise, with the COLUMN(S) functions. The row reference is irrelevant and doesn't need to be made absolute.

    COLUMNS($A1:F1)

    Also, quoted cell references within the INDIRECT function will never change since the reference is a text string. The INDIRECT function will automatically evaluate them as absolute references so there's no need for the $ signs.

    indirect("'"&$a$10&"'!a2:h10")

    INDIRECT("'"&$A$10&"'!A"&ROWS(A$1:A2)&":H10")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Dynamic Vlookup Formula to get information from different worksheets

    martindwilson and Tony Valko,

    Thank you for your asistance, I have it working well. What is best way to deal with N/A if a worksheet has nothing on that line?

    Thanks again, you guys rock!!!

    BigDawg15

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

    Re: Dynamic Vlookup Formula to get information from different worksheets

    ROWS(A$1:A2) doesnt look as neat as =ROWS($A$1:$A2) when dragged across
    like wise
    =COLUMNS($A$1:F$1) looks better when dragged down

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

    Re: Dynamic Vlookup Formula to get information from different worksheets

    wrap the formula in iferror
    =iferror(VLOOKUP($A$10,INDIRECT("'"&$A$10&"'!$A"&ROWS($A$1:$A2)&":$H$10"),COLUMNS($A$1:F$1),FALSE),"")

  7. #7
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Dynamic Vlookup Formula to get information from different worksheets

    Brilliant,

    Thank you so much.

    Cheers,

    BigDawg15

  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: Dynamic Vlookup Formula to get information from different worksheets

    doesnt look as neat
    All those unnecessary $ signs make the formula harder to read.

    INDIRECTs with all those double and single quotes along with all the $ signs can be hard to read. If you don't need the dollar signs why include them? They have no effect whatsoever on the formula result.

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

    Re: Dynamic Vlookup Formula to get information from different worksheets

    well my eyes must be better then

  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: Dynamic Vlookup Formula to get information from different worksheets

    Compared to mine, that's pretty much a guarantee.

    I'm almost blind (for real).

  11. #11
    Registered User
    Join Date
    02-01-2011
    Location
    California, Sacramento
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: Dynamic Vlookup Formula to get information from different worksheets

    Thanks again to you both. Helped me understand the workings of the formula a little better.

    Cheers,

    BigDawg15

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

    Re: Dynamic Vlookup Formula to get information from different worksheets

    You're welcome. Thanks for the feedback!

+ 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. Dynamic vlookup from several worksheets
    By BJ83 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2013, 03:19 PM
  2. Replies: 10
    Last Post: 08-12-2013, 12:02 PM
  3. [SOLVED] Formula help on information sharing between 3 worksheets
    By Macmo in forum Excel General
    Replies: 7
    Last Post: 05-13-2006, 11:50 AM
  4. [SOLVED] Cell sizing in a Vlookup formula to fit information.
    By Mike in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-03-2006, 01:15 PM
  5. [SOLVED] VLOOKUP to pick information from two worksheets
    By mikeclimb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-13-2006, 03:20 PM

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