Consulting

Results 1 to 13 of 13

Thread: vlookup and hlookup on multiple criteria

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

    vlookup and hlookup on multiple criteria

    I have a table with two row header and one column header.

    My row header is Month on a1 and down, on B1 and down, I have name and these names many repeate each month.

    On my column, I have type such as backlong, on hold...

    I was wondering if there is a way to use vlookup to look up for example

    In december (vlookup), how many backlong(hlookup), for a name (hlookup again)?

    Please see my attach file for example

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Just use a formula of

    =SUMPRODUCT(--($A$2:$A$28=$A35),--($B$2:$B$28=$B35),--ISNUMBER(C$2:C$28))

    copy down and across
    ____________________________________________
    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
    Thanks xld, but what happen if the column header are not in the same order as the table provided. Please see attached.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    No problem

    =SUMPRODUCT(($A$2:$A$28=$A35)*($B$2:$B$28=$B35)
    *($C$1:$I$1=C$34)*(ISNUMBER($C$2:$I$28)))
    ____________________________________________
    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
    thanks xld, I use it but i only get a value of one or 2 back? Please help.

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    I see two 2s and two 1s there.
    ____________________________________________
    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

  7. #7
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    really, I highlighted the return value and the actual value in the attached file. They don't match.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Are you saying that you want to sum them not count?

    =SUMPRODUCT(($A$2:$A$28=$A35)*($B$2:$B$28=$B35)*($C$1:$I$1=C$34)
    *(ISNUMBER($C$2:$I$28))*($C$2:$I$28))
    ____________________________________________
    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
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    can we display that actual value of the cell instead?

  10. #10
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Which value? Ther can be more than 1.
    ____________________________________________
    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

  11. #11
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    I hightlighted the value that I want return in the attached file. Thanks so much for you help xld

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    It is not sufficient to show which you want, you need to explain why. Why the second Feb-09 for Thaison, why not the first.
    ____________________________________________
    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

  13. #13
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    244
    Location
    I'm sorry, I made a mistake, there should only be one thaison. For each month, each name can only appear there once. If twice, we pick either one.

Posting Permissions

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