Consulting

Results 1 to 5 of 5

Thread: Solved: vlookup with multiple criteria

  1. #1
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location

    Solved: vlookup with multiple criteria

    I used vlookup a lot but I've always been using it with single criteria. but now, I need it for multiple criteria. For example, column A2 - A5 = A and B2- B5 is P2, P3, P4. I want to be able to lookup for A and A5.

    Please refer to the file and picture below.

    i want to be able to lookup C,P2 and return 55 for billy.

    thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this array formula

    =INDEX(A1:G21,MATCH(1,(A1:A21="C2")*(B1:B21="P"),0),MATCH("Billy",A1:G1,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

  3. #3
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    wow, thanks a lot xld, i have to change some names around but works perfect. I looked up index in google but don't quite understand how that works, can you educate me a little on that?

    does this mean i can do this with 3 criteria also? is there a limit?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    INDEX will return the intersection of the stipulated row and column within a given range. So

    INDEX(A1:M10,5,4) returns the value in cell D5, whereas

    INDEX(B3:M10,5,4) returns the value in cell E7.

    The two matches are used to calculate those row and column numbers.
    ____________________________________________
    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

  5. #5
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    i get it, thanks

Posting Permissions

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