+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : How can I use listbox selection to drive array name in a lookup function?

  1. #1
    Registered User
    Join Date
    02-16-2011
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    How can I use listbox selection to drive array name in a lookup function?

    I'm building a pricing calculator that depends on selections from a list box, one of which I'd like to use in a lookup function (e.g. vlookup as the table_array argument) but I get #value error when I reference the cell containing the listbox. I've tried naming the range and naming a table as well as all lookup and reference functions to no avail. I'm pretty sure I've done this before! Scratching my head...I need this to work so that I can automatically select from dozens of tables (or arrays) of data based on user input.

    So, I have a dropdown that contains list elements name1, name2, name3 in cell a1 which are named ranges on separate tabs
    another dropdown contains list elements size1, size2, size3 in cell a2
    another dropdown contains list elements color1, color2, color3 in cell a3
    I use match to find the column number for size...match(A2,A1,0) results in b2
    I use vlookup to find the cost...vlookup(a3,a1,b2,false)
    The trouble seems to be I can't use a1 in the array argument for match or vlookup, but I need to be able to look at different tables based on user input
    Last edited by davidcmichael; 02-17-2011 at 11:04 AM. Reason: on advice from moderator

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: How can I use listbox selection to drive array name in a lookup function?

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  3. #3
    Registered User
    Join Date
    02-16-2011
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How can I use listbox selection to drive array name in a lookup function?

    This is the suggested attached workbook
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-16-2011
    Location
    Knoxville, TN
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How can I use listbox selection to drive array name in a lookup function?

    I'm pretty sure I've solved my own problem with this:
    =INDEX(INDIRECT(A1),MATCH(A3,INDIRECT("'"&A1&"'!a2:a4"),0)+1,MATCH(A2,INDIRECT("'"&A1&"'!B1:D1"),0)+1)
    It works in my test workbook anyway.
    If anyone can come up with a non-volatile solution I'd be grateful!

+ 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