Tauren
Tauren

Reputation: 37

Returning a value based on max sum and one more condition

      A         B         C
1     #         Code    Quantity
2     1001      1         10
3     1001      1         20
4     1002      2         10
5     1003      2         10
6     1003      2         10
7     1003      2         10
8     1004      1         40
9     1005      3         20

I want to display in A11: The # in A, who has the Code 1 in B, and who has the largest quantity in C.

I figure it requires Index Match Max Sumif and Vlookup, but i've no idea how to put them together(

Thanks to anyone for any kind of suggestion!

Upvotes: 1

Views: 200

Answers (1)

JMax
JMax

Reputation: 26591

Here is what you can do

=INDEX(A1:A9,MAX(ROW(C1:C9)*(C1:C9=1)*(D1:D9=MAX($D$1:$D$9))))

This is an array formula you have to validate with Ctrl+Shift+Enter

[EDIT] The final solution that worked for Tauren:

=INDEX(A1:A9,MAX(ROW(B1:B9)*(B1:B9=1)*(C1:C9=MAX(C1:C9))))

And the french version for whoever would need it:

=INDEX(A1:A9;MAX(LIGNE(C1:C9)*(C1:C9=1)*(D1:D9=MAX($D$1:$D$9))))

Upvotes: 1

Related Questions