Formula to retrieve values from duplicate data with multiple criteria

ybr_15

Board Regular
Joined
May 24, 2016
Messages
204
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi, I have this data:
TEST 1.xlsx
BCDEFGHIJKLM
2DATARESULT
3
4SKUTitleCategoryContain BoxRackWHSKUTitleCategoryRackWH
5111201.067Data 1TK210RA13 420111201.067Data 1TKRA13 420
6111201.069Data 2TK210RA13 210111201.069Data 2TKRA13 210
7111201.081Data 3TK40B32 40111201.081Data 3TKB32 40
8111201.082Data 4TK60B32 60111201.082Data 4TKB32 60
9111201.083Data 5TK30A27 30111201.083Data 5TKA27 30
10111201.084Data 6TK27A27 27111201.084Data 6TKA27 27
11111201.085Data 7TK110A27 110111201.085Data 7TKA27 200
12111201.085Data 7TK200A27 200111201.086Data 8TKA27 200
13111201.085Data 7TK Total310111201.087Data 9TKRA25 250
14111201.086Data 8TK200A27 200111201.089Data 10TKRB05 260
15111201.086Data 8TK90A27 90111201.091Data 11TKA07 250
16111201.086Data 8TK Total290
17111201.087Data 9TK250RA25 250
18111201.089Data 10TK260RB05 260
19111201.091Data 11TK250A07 250
20111201.091Data 11TKRA14 250
Sheet1
Cell Formulas
RangeFormula
M5:M15M5=MAX(IF($B$5:$B$20=I5,IF($C$5:$C$20=J5,IF($D$5:$D$20=K5,$G$5:$G$20))))
Press CTRL+SHIFT+ENTER to enter array formulas.

I want to get the result as shown in the "RESULT" table based on the reference in the "DATA" table. I want to retrieve the data with the highest value using a formula with 3 criteria and get the result as shown in column "WH" (column M). The result of the formula is the same as I want. But, with the same criteria, I'm having a hard time getting a formula so that the results are as shown in the "Rack" column (column L) where the highest value comes from. Can anyone help me?. Thank you
 
Try this. I have altered the column N formula so that it matched the column P formula format. This might make it easier for you if you wanted to extend further beyond 3rd highest.
Colours were just for my benefit in checking

ybr_15.xlsm
BCDEFGHIJKLMNOPQ
31st Highest2nd Highest3rd Highest
4SKUTitleCategoryContain BoxRackWHSKUTitleCategoryRackWHRackWHRackWH
5111201.067Data 1TK210RA13 420111201.067Data 1TKRA13 420    
6111201.069Data 2TK210RA13 210111201.069Data 2TKRA13 210    
7111201.081Data 3TK40B32 40111201.081Data 3TKB32 40    
8111201.082Data 4TK60B32 60111201.082Data 4TKB32 60    
9111201.083Data 5TK30A27 30111201.083Data 5TKA27 30    
10111201.084Data 6TK27A27 27111201.084Data 6TKA27 27    
11111201.085Data 7TK110A27 110111201.085Data 7TKA27 200A27 110  
12111201.085Data 7TK200A27 200111201.086Data 8TKA27 200A27 90  
13111201.085Data 7TK Total310111201.087Data 9TKRA25 250    
14111201.086Data 8TK200A27 200111201.089Data 10TKRB05 260    
15111201.086Data 8TK90A27 90111201.091Data 11TKA07 250RA14 250  
16111201.086Data 8TK Total290121205.126Data 12PLATINUMB24 120B24 24B24 20
17111201.087Data 9TK250RA25 250121205.159Data 13PLATINUMB30 560B28 120B28 25
18111201.089Data 10TK260RB05 260121411.078Data 14GLOBALA11 66A12 66RB03 66
19111201.091Data 11TK250A07 250
20111201.091Data 11TKRA14 250
21111201.091Data 11TK Total500
22121205.126Data 12PLATINUM20B24 20
23121205.126Data 12PLATINUM24B24 24
24121205.126Data 12PLATINUM40B24 120
25121205.126Data 12PLATINUM Total164
26121205.159Data 13PLATINUM25B28 25
27121205.159Data 13PLATINUM40B28 120
28121205.159Data 13PLATINUM40B30 560
29121205.159Data 13PLATINUM Total705
30121411.078Data 14GLOBAL66A11 66
31121411.078Data 14GLOBAL66A12 66
32121411.078Data 14GLOBAL66RB03 66
33121411.078Data 14GLOBAL Total198
Sheet1
Cell Formulas
RangeFormula
L5:L18L5=INDEX(F$5:F$33,AGGREGATE(15,6,(ROW(F$5:F$33)-ROW(F$5)+1)/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)*(G$5:G$33=M5)),1))
M5:M18M5=AGGREGATE(14,6,G$5:G$33/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)),1)
N5:N18N5=IF(O5="","",INDEX(F$5:F$33,AGGREGATE(15,6,(ROW(F$5:F$33)-ROW(F$5)+1)/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)*(G$5:G$33=O5)),1+COUNTIFS($L$4:$M$4,"WH",L5:M5,O5))))
O5:O18O5=IFERROR(AGGREGATE(14,6,G$5:G$33/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)),2),"")
P5:P18P5=IF(Q5="","",INDEX(F$5:F$33,AGGREGATE(15,6,(ROW(F$5:F$33)-ROW(F$5)+1)/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)*(G$5:G$33=Q5)),1+COUNTIFS($L$4:$O$4,"WH",L5:O5,Q5))))
Q5:Q18Q5=IFERROR(AGGREGATE(14,6,G$5:G$33/((B$5:B$33=I5)*(C$5:C$33=J5)*(D$5:D$33=K5)),3),"")
Hi, Peter_SSs

Thanks for the improvement on the formula, the solution you provided really helped my problem. Now I can make formulas for the 4th etc. Thanks again and have a nice weekend:giggle:🙏
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top