Consulting

Results 1 to 9 of 9

Thread: Solved: Return based on mutliple criteria

  1. #1

    Solved: Return based on mutliple criteria

    Greetings,
    I have 2 list boxes (Various Names and Date) and I want to extract a value on another page based on those 2 choices. I am thinking INDEX and MATCH but I am not sure how to lay it out. Any help would be appreciated! Thanks!

  2. #2
    VBAX Regular MikeWolfeJr's Avatar
    Joined
    Nov 2005
    Location
    Lancaster, PA
    Posts
    7
    Location

    Question

    Hi...

    Can you give a little more detail? Are the listboxes on a form or on a worksheet? How is the data laid-out on the other worksheet from which you want to do the lookup? Where is the the extracted value to be placed?

    You may be able to get away with using VLookup.

  3. #3
    Hello,

    The list boxes are currently cells using data validation. One for misc. names and one for misc dates. When the user chooses a name and date I need to fill in various catagories in a table. ie. hours worked, or the individuals function for that month.
    Select Employee: (listbox)
    Select Month: (listbox)
    Hours Worked: Result

  4. #4
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Good questions Mike. Pizzafiend, would it be possible for you to post your file here so we can take a look at it....be sure to strip out any personal information so that its a generic example. Just zip it up and use manage attachments at the bottom of the post reply page.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Pizzafiend
    Hello,

    The list boxes are currently cells using data validation. One for misc. names and one for misc dates. When the user chooses a name and date I need to fill in various catagories in a table. ie. hours worked, or the individuals function for that month.
    Select Employee: (listbox)
    Select Month: (listbox)
    Hours Worked: Result
    A few assumptions

    The hours worked is a table say B2:N16, where months are C2:N2, employees are B3:B16. The result comes from

    =OFFSET(B2,MATCH(Employee,B3:B16,0),MATCH(Month,C2:N2,0))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6

    Question

    Here is a sample sheet that I threw together. It represents the problem on a minor scale (thought it would be easier to work with instead of the actual project I am working on). Again, any help or direction would be greatly appreciated. Thanks!

    Danny

  7. #7
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Use this formula in cell C2:


    =LOOKUP(2,1/((Sheet2!A2:A100=A2)*(Sheet2!B2:B100=B2)),Sheet2!C2:C100)

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Pizzafiend
    Here is a sample sheet that I threw together. It represents the problem on a minor scale (thought it would be easier to work with instead of the actual project I am working on). Again, any help or direction would be greatly appreciated. Thanks!

    Danny
    =INDEX(Sheet2!C2:C36,MATCH(A2&B2,Sheet2!A2:A36&Sheet2!B2:B36,0))

    as an array formula
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Thanks xld and Shazam, both of those seem to work great.

    xld, I had the formula that you had, but I didn't match the array after the index statement with the other columns I was referencing. At least I can rest easy that I wasn't totally off base.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •