Spreadsheet: 164523d1340803503-sorting-data-by-grouped-results-sorting-multiple-columns
Sheet: Database

 |  | Product #1 | Product #2 | Product #3 | Product #4 | Product #5 | Product #6 |  |  |  |  |  | Product #1 | Product #2 | Product #3 | Product #4 | Product #5 | Product #6
 | Product | p001 | p002 | p003 | p004 | p005 |  |  |  |  |  | Product | p001 | p002 | p003 | p004 | p005
 | Company Code | Product #1 | Product #2 | Product #3 | Product #4 | Product #5 | Product #6 |  |  |  |  | Company Code | Product #1 | Product #2 | Product #3 | Product #4 | Product #5 | Product #6
 | Company #1 | Yes - 142 | Yes - 139 | Yes - 37 | Yes - 0 | Yes - 1 |  | 5 | 319 | 630 |  | Company #1 | Yes - 142 | Yes - 139 | Yes - 37 | Yes - 0 | Yes - 1 |  | 5 | 319 | 630
 | Company #2 | Yes - 13 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 13 | 15 |  | Company #2 | Yes - 13 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 13 | 15
 | Company #3 | Yes - 2 | Yes - 3 | Yes - 7 | Yes - 0 | Yes - 0 |  | 5 | 12 | 21 |  | Company #3 | Yes - 2 | Yes - 3 | Yes - 7 | Yes - 0 | Yes - 0 |  | 5 | 12 | 21
 | Company #4 | Yes - 5 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 5 | 16 |  | Company #4 | Yes - 5 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 5 | 16
 | Company #5 | Yes - 1 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 1 | 1 |  | Company #5 | Yes - 1 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 1 | 1
 | Company #6 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 354 |  | Company #6 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 354
 | Company #7 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 62 |  | Company #7 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 62
 | Company #8 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 38 |  | Company #8 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 38
 | Company #9 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 24 |  | Company #9 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 24
 | Company #10 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 17 |  | Company #10 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 17
 | Company #11 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 10 |  | Company #11 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 10
 | Company #12 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 9 |  | Company #12 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 9
 | Company #13 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 9 |  | Company #13 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 9
 | Company #14 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 6 |  | Company #14 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 6
 | Company #15 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 6 |  | Company #15 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 6
 | Company #16 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 5 |  | Company #16 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 5
 | Company #17 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4 |  | Company #17 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4
 | Company #18 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4 |  | Company #18 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4
 | Company #19 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4 |  | Company #19 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4
 | Company #20 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4 |  | Company #20 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 4
 | Company #21 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 3 |  | Company #21 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 3
 | Company #22 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2 |  | Company #22 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2
 | Company #23 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2 |  | Company #23 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2
 | Company #24 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2 |  | Company #24 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2
 | Company #25 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2 |  | Company #25 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 2
 | Company #26 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #26 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #27 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #27 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #28 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #28 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #29 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #29 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #30 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #30 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #31 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #31 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #32 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1 |  | Company #32 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  | 5 | 0 | 1
 | Company #33 | Yes - 266 | Yes - 48 | Yes - 5 | Yes - 0 |  |  | 4 | 319 | 738 |  | Company #33 | Yes - 266 | Yes - 48 | Yes - 5 | Yes - 0 |  |  | 4 | 319 | 738
 | Company #34 | Yes - 15 | Yes - 19 | Yes - 8 | Yes - 0 |  |  | 4 | 42 | 76 |  | Company #34 | Yes - 15 | Yes - 19 | Yes - 8 | Yes - 0 |  |  | 4 | 42 | 76
 | Company #35 | Yes - 27 | Yes - 1 | Yes - 0 | Yes - 0 |  |  | 4 | 28 | 68 |  | Company #35 | Yes - 27 | Yes - 1 | Yes - 0 | Yes - 0 |  |  | 4 | 28 | 68
 | Company #36 | Yes - 0 | Yes - 1 | Yes - 22 |  | Yes - 0 |  | 4 | 23 | 147 |  | Company #44 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  |  | 4 | 0 | 1
 | Company #37 | Yes - 0 | Yes - 0 | Yes - 5 |  | Yes - 0 |  | 4 | 5 | 9 |  | Company #36 | Yes - 0 | Yes - 1 | Yes - 22 |  | Yes - 0 |  | 4 | 23 | 147
 | Company #38 | Yes - 3 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 3 | 41 |  | Company #37 | Yes - 0 | Yes - 0 | Yes - 5 |  | Yes - 0 |  | 4 | 5 | 9
 | Company #39 | Yes - 1 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 1 | 1 |  | Company #38 | Yes - 3 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 3 | 41
 | Company #40 | Yes - 0 | Yes - 0 |  | Yes - 0 | Yes - 0 |  | 4 | 0 | 38 |  | Company #39 | Yes - 1 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 1 | 1
 | Company #41 | Yes - 0 | Yes - 0 |  | Yes - 0 | Yes - 0 |  | 4 | 0 | 13 |  | Company #42 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 10
 | Company #42 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 10 |  | Company #43 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 4
 | Company #43 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 4 |  | Company #45 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 1
 | Company #44 | Yes - 0 | Yes - 0 | Yes - 0 | Yes - 0 |  |  | 4 | 0 | 1 |  | Company #40 | Yes - 0 | Yes - 0 |  | Yes - 0 | Yes - 0 |  | 4 | 0 | 38
 | Company #45 | Yes - 0 | Yes - 0 | Yes - 0 |  | Yes - 0 |  | 4 | 0 | 1 |  | Company #41 | Yes - 0 | Yes - 0 |  | Yes - 0 | Yes - 0 |  | 4 | 0 | 13
 | Company #46 | Yes - 163 | Yes - 26 |  | Yes - 0 |  |  | 3 | 189 | 215 |  | Company #47 | Yes - 55 | Yes - 1 | Yes - 0 |  |  |  | 3 | 56 | 205
 | Company #47 | Yes - 55 | Yes - 1 | Yes - 0 |  |  |  | 3 | 56 | 205 |  | Company #49 | Yes - 10 | Yes - 0 | Yes - 0 |  |  |  | 3 | 10 | 16
 | Company #48 | Yes - 10 | Yes - 1 |  | Yes - 0 |  |  | 3 | 11 | 27 |  | Company #50 | Yes - 1 | Yes - 0 | Yes - 1 |  |  |  | 3 | 2 | 35
 | Company #49 | Yes - 10 | Yes - 0 | Yes - 0 |  |  |  | 3 | 10 | 16 |  | Company #46 | Yes - 163 | Yes - 26 |  | Yes - 0 |  |  | 3 | 189 | 215
 | Company #50 | Yes - 1 | Yes - 0 | Yes - 1 |  |  |  | 3 | 2 | 35 |  | Company #48 | Yes - 10 | Yes - 1 |  | Yes - 0 |  |  | 3 | 11 | 27
 |  | IF(AND(OR(ISNUMBER(SEARCH(D$3,VLOOKUP($B57,$AG$7:$AZ$2627,19,FALSE))),ISNUMBER(SEARCH(D$3,VLOOKUP($B57,$AG$7:$AZ$2627,20,FALSE)))),OR(ISNUMBER(SEARCH(D$4,VLOOKUP($B57,$AG$7:$AZ$2627,19,FALSE))),ISNUMBER(SEARCH(D$4,VLOOKUP($B57,$AG$7:$AZ$2627,20,FALSE))))),"Yes - "&SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(D$3="",1,$AD$7:$AD$8402=[NAME]=D$4))),"") | - | - | - | - | - | COUNTIF(D57:I57,"Yes - *") | SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(D$3="",1,$AD$7:$AD$8402=[NAME]D$4)))+SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(E$3="",1,$AD$7:$AD$8402=E$3))*(IF(E$4="",1,$AE$7:$AE$8402=E$4)))+SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(F$3="",1,$AD$7:$AD$8402=F$3))*(IF(F$4="",1,$AE$7:$AE$8402=F$4)))+SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(G$3="",1,$AD$7:$AD$8402=G$3))*(IF(G$4="",1,$AE$7:$AE$8402=G$4)))+SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(H$3="",1,$AD$7:$AD$8402=H$3))*(IF(H$4="",1,$AE$7:$AE$8402=H$4)))+SUMPRODUCT(($AC$7:$AC$8402=$B57)*(IF(I$3="",1,$AD$7:$AD$8402=I$3))*(IF(I$4="",1,$AE$7:$AE$8402=I$4))) | COUNTIF($AC$7:$AC$10000,B57) | -