# Formula to find Max number of items in orders



## campos1578 (Dec 19, 2022)

Hey Gurus,

I've randomly generated Item numbers and Order Numbers from a separate worksheet and Copy/Pasted into this worksheet.
Column A has item numbers which may repeat. Column B also has Order Numbers that may repeat. Column C is using vlookup reference from a different worksheet

My intent: Use a formula that finds the maximum number of Item number combinations (Column A) that are in all order numbers (Column B) and return in a list of order numbers, item numbers, and the count of combinations. Then find the second highest combination and list the list and return the same until there are 0 combinations left. I'll work with however many formulas are required and referencing as needed. 

Thank You!


ABCItem NumberOrder NumberDescription1​10801127​1​Cool Whip Extra Creamy Whipped Cream Topping, 8 oz Tub2​23554586​1​OREO Double Stuf Chocolate Sandwich Cookies, Family Size, 20 oz3​50228527​1​Great Value Baked Buttery Round *******s, 13.7 oz4​10421746​1​KING'S HAWAIIAN Savory Butter Rolls, 12 Pack5​29209893​1​Bar-S Classic Bologna Sliced Deli-Style Lunch Meat, 10 Slices Per Package, 12 Ounce Pack6​51259212​1​Yellow Onions, Each7​44391605​1​Fresh Strawberries, 1 lb8​242699420​1​Great Value Cauliflower, 12 oz (Frozen)9​981077201​1​Premium Grape Tomato, 10 oz Package10​287905711​1​Great Value Chopped Pecans, 4 oz11​11303936​1​Great Value Marshmallows, 10 oz12​100546946​1​Tyson All Natural, Fresh, Boneless, Skinless Chicken Breasts, 2.5 - 4.0 lb13​10813483​1​Totino's Party Pizza, Combination, Frozen Snacks, 10.7 oz, 1 ct14​305034239​1​Freshness Guaranteed Homestyle Breaded Chicken Sandwich15​287474410​1​Tasteful Selections Honey Gold Potatoes, 24 Oz.16​10450339​1​Great Value Ultra-Pasteurized Real Heavy Whipping Cream, 16 Oz17​808179972​1​Dr Pepper Zero Sugar Soda, 20 fl oz bottle18​872271913​1​Great Value Steamable Fine Green Beans, Frozen, 12 oz19​994038828​1​Great Value Peas & Carrots, 12 oz (Frozen)20​10534045​1​Great Value Dark Red Kidney Beans, 15.5 oz21​10314968​1​Great Value Brown Gravy Mix, 0.87 oz22​415310707​1​(Hot) Freshness Guaranteed Rotisserie Chicken, Lemon Pepper, Cooked, Ready to Serve, 36 oz23​10450895​1​Maruchan Instant Lunch Shrimp Flavor Noodle Soup, 2.25 Oz24​13893732​1​Marketside Organic Spring Mix Salad, 5 oz25​12018560​1​Monster Energy Original, Energy Drink, 16 fl oz26​10324377​1​Fresh Mini Sweet Peppers, 16 oz bag27​10452308​1​Lunchables Extra Cheesy Pizza Kids Lunch Snack, 4.2 oz Tray28​10450895​1​Maruchan Instant Lunch Shrimp Flavor Noodle Soup, 2.25 Oz29​37846296​1​Takis Fuego Flavored Tortilla Chips, 9.9 Oz30​10308950​1​McCormick Brown Gravy Mix, 0.87 oz31​44391008​1​Limes, 1 each32​269796224​1​Great Value Ultra Paper Plates, 10", 50 Count33​10315383​1​Great Value Purified Drinking Water, 1 Gallon34​10450988​1​Great Value Canola Oil, 48 fl oz35​46908368​1​Birds Eye Steamfresh Super Sweet Corn, Frozen Corn, 10 Oz36​10452564​1​Great Value Finely Shredded Colby Jack Cheese, 8 oz37​33411325​1​Reese's Big Cup King Size Peanut Butter Milk Chocolate Candy Cups, 2.8 Oz38​10416105​1​Great Value Petite Diced Tomatoes in Tomato Juice, 14.5 Oz39​10452662​1​Sam's Choice, Pork, Spiral-Cut, Boneless, Brown Sugar Double Glazed Ham, 2.0 - 4.8lbs40​10319370​1​Pillsbury Grands! Flaky Layers Original Biscuits, 8 ct., 16.3 oz.41​10314957​1​Great Value Tomato Condensed Soup, 10.75 oz42​51259338​1​Marketside Organic Bananas, Bunch43​23511056​1​Pillsbury Cinnamon Rolls with Original Icing, 2-Pack, 16 Count44​44419690​1​Fresh Mini Cucumber, 1lb bag45​41752773​1​Lemons, each46​41752773​1​Lemons, each47​10314960​1​Great Value Cream of Mushroom Condensed Soup, 10.5 oz48​10448318​1​Great Value Canned Cut Green Beans, 14.5 oz Can49​10308581​1​Rotel Original Diced Tomatoes and Green Chilies, 10 oz.50​20525252​1​Great Value Homestyle Vanilla Flavored Ice Cream, 48 fl oz51​43711099​1​Great Value Yellow Mustard, 20 oz Squeeze Bottle52​10532755​1​Romaine Lettuce Hearts, 3 Pack53​19802852​1​GV All Purpose Flour 2LB Bag54​10315382​1​Great Value Distilled Water, 1 Gallon55​469615088​1​Freshness Guaranteed Popcorn Chicken56​44391018​1​Fresh Jalapeno Pepper, approx. 3-5 per 0.25 lb57​10450340​1​Great Value Ultra-Pasteurized Real Heavy Whipping Cream, 32 Oz58​44390949​1​Hass Avocados, Each59​10533856​1​Jimmy Dean Premium Pork Hot Sausage Roll, 16 oz60​21788698​1​Great Value Mild Diced Tomatoes with Green Chilies, 10 Oz61​15136784​1​Dr Pepper Soda, .5 L bottles, 6 pack62​23597919​2​La Banderita Ricas Flour Tortillas Family Pack, 20 count, 22.5 oz63​10314928​2​Great Value Cherry Pie Filling or Topping, 21 oz64​10315427​2​Great Value Whole Kernel Corn, Canned Vegetables, 14.5-15 oz65​10533733​2​Wright Brand Thick Cut Hickory Real Wood Smoked Bacon, 1.5 lb66​10447842​2​Yellow Onions 3 lb Bag67​10402651​2​Celery Hearts68​10291579​2​Coca-Cola Soda Soft Drink, 12 fl oz, 8 Pack69​13893733​2​Marketside Organic Baby Spinach Salad, 5 oz70​10452662​2​Sam's Choice, Pork, Spiral-Cut, Boneless, Brown Sugar Double Glazed Ham, 2.0 - 4.8lbs71​10291661​2​Armour LunchMakers Turkey & Cheese, *******s & Butterfinger, 2.4 oz Meal Kit72​44391090​2​Blue Bell Gold Rim Homemade Vanilla Ice Cream Half Gallon, 64 fl oz73​10315384​2​Great Value Spring Water, 1 gal74​10449950​2​Red Potatoes, 5lb bag75​10534084​2​Great Value PENNE, 16OZ76​10320937​2​Nissin Teriyaki Beef Flavor Chow Mein Noodles, 4 oz77​47770124​2​Fresh Color Bell Peppers, 3 count78​10320485​2​Williams Original Chili Seasoning 1 oz. Packet79​10309108​2​Buddig Original Sliced Honey Ham, 2 oz80​10448549​2​Great Value Canned Cream Style Sweet Corn, 14.75 oz81​38253425​2​REESE'S, Milk Chocolate Peanut Butter Cups Candy, Gluten Free, 1.5 oz, Pack82​100470326​2​Great Value Shredded Medium Cheddar Cheese, 16 oz83​12444455​2​Great Value French Fried Onions, 6 oz84​21804014​2​Miloís Famous Sweet Tea, 100% Natural, 128 Fl. Oz.85​108065286​2​Pringles Potato Crisps Chips, Sour Cream and Onion, 5.5 oz86​12018772​2​Red Bull Energy Drink, 12 Fl Oz87​13812845​2​El Monterey Beef & Bean Burritos, 32 oz Family Size, 8 Ct (Frozen)88​23554586​2​OREO Double Stuf Chocolate Sandwich Cookies, Family Size, 20 oz89​15570901​2​Maruchan Ramen Noodle Beef Flavor Soup, 3 Oz90​196583918​2​HERSHEY'S, HERSHEY-ETS Candy Coated Milk Chocolate Candy, Christmas, 1.4 oz, Filled Plastic Cane91​10321636​2​Campbell's Condensed Tomato Soup, 10.75 Ounce Can92​19758051​2​Great Value Traditional Pasta Sauce, 24 oz93​15241047​2​Honeysuckle WhiteÆ Frozen Bone-In Turkey Breast with Gravy, 3-9 lb, Serves 2 to 694​10534163​2​Great Value Evaporated Milk, 12 Fl Oz95​190596552​2​Great Value Shredded Medium Cheddar Cheese, 8 oz96​287001150​2​2-Ply Paper Towels, 1 Roll, 88 Sheets97​10449184​2​Freshness Guaranteed Sliced White Mushrooms 8oz98​10452421​2​Great Value Shredded Low-Moisture Part-Skim Mozzarella Cheese, 16 oz99​10805206​2​Sister Schubert's Dinner Yeast Rolls, 15 oz, 10 Count Bag100​21501684​2​Tyson Fresh Pork Spareribs, 4.18 - 6.0 lb101​142689942​2​McCormick Taco Seasoning Mix, 1 oz102​46575468​2​Great Value Original Premium Sausage Roll, 16 oz103​46491761​2​Freshness Guaranteed Italian Bread Loaf, 14 Oz104​10451316​2​Baby Carrots, 2lb bag105​10533933​2​Great Value Premium Original Shells & Cheese, 12 oz Shelf Stable106​55014398​2​Fresh Garlic Sleeve, 3 Count107​41752773​2​Lemons, each108​10448133​2​Jiffy Corn Muffin Mix, 8.5 Oz.109​902180779​2​Brach's Peppermint Holiday Candy Canes, Christmas Stocking Stuffer Candy, 5.3 Oz, 12 Count110​10450988​3​Great Value Canola Oil, 48 fl oz111​902180779​3​Brach's Peppermint Holiday Candy Canes, Christmas Stocking Stuffer Candy, 5.3 Oz, 12 Count112​10315384​3​Great Value Spring Water, 1 gal113​10315437​3​Great Value Canned Pineapple Chunks packed in 100% Pineapple juice, 20 oz114​10295545​3​Philadelphia Original Cream Cheese, 8 oz Brick115​44390943​3​Fresh Green Seedless Grapes, Bag116​193378699​3​Hiland Chocolate Milk, 1 Pint117​15716579​3​French's Original Crispy Fried Onions, 6 oz118​10452414​3​Great Value Finely Shredded Parmesan Cheese, 6 oz119​510580773​3​Marzetti Classic Caramel Dip, 13.5 oz120​47088918​3​Kraft Mexican Style Four Cheese Blend Shredded Cheese, 8 oz Bag121​15241047​3​Honeysuckle WhiteÆ Frozen Bone-In Turkey Breast with Gravy, 3-9 lb, Serves 2 to 6122​19276183​3​Diet Dr Pepper Soda, 20 fl oz bottle123​10801136​3​Cool Whip Original Whipped Cream Topping, 16 oz Tub124​10291058​3​Land O LakesÆ Salted Butter, 4 Butter Sticks, 1 lb Pack125​23597919​3​La Banderita Ricas Flour Tortillas Family Pack, 20 count, 22.5 oz126​46491672​3​Shredded Carrots, 10 Oz Bag127​10450904​3​Maruchan Ramen Noodle Chicken Flavor Soup, 3 Oz, 12 Count128​15754233​3​Maruchan Ramen Noodle Chicken Flavor Soup, 3 Oz129​10533733​3​Wright Brand Thick Cut Hickory Real Wood Smoked Bacon, 1.5 lb130​190596552​3​Great Value Shredded Medium Cheddar Cheese, 8 oz131​22660282​3​Fresh Strawberries, 2 lb132​42294613​3​Perdue Harvestland Free Range Fresh Boneless Skinless Chicken Breasts, 1.3-1.9 lb133​41752773​3​Lemons, each134​44390971​3​Slicing Tomato, Each135​44391004​3​Russet Baking Potatoes, each136​379517847​3​Great Value Original Taco Seasoning Mix, 1 oz137​461640922​3​Organic Rosemary138​220510325​3​Great Value Corn Chips, 9.25 oz139​10321291​3​Red Diamond Fresh Brewed Southern Sweet Tea, 1 Gallon140​10534038​3​Great Value Black Beans, 15 oz Can141​46330157​3​Great Value Chicken Broth, 48 oz142​305034239​3​Freshness Guaranteed Homestyle Breaded Chicken Sandwich143​10315162​3​Great Value Pure Granulated Sugar, 4 lb144​23597919​3​La Banderita Ricas Flour Tortillas Family Pack, 20 count, 22.5 oz145​339860540​3​Great Value Burrito Flour Tortillas, 20 oz, 8 Count146​35176551​3​RITZ Fresh Stacks Original *******s, 8 Count, 11.8 oz147​44391216​3​Hiland Farmer Owned French Onion Dip, 16 oz Tub148​10416519​3​Great Value Garlic Texas Toast, 11.25 oz, 8 Count149​41592222​3​Great Value Cream Cheese, 8 oz, 2 count150​10295586​3​Velveeta Original Melting Cheese Dip & Sauce, 16 oz Block151​42294615​3​Perdue Harvestland Free Range Fresh Boneless Skinless Chicken Breast Tenderloins, 0.8-1.2 lb152​23511056​3​Pillsbury Cinnamon Rolls with Original Icing, 2-Pack, 16 Count153​41752773​3​Lemons, each154​10416105​3​Great Value Petite Diced Tomatoes in Tomato Juice, 14.5 Oz155​44391581​3​Fresh Red Bell Pepper, 1 Each156​10309102​3​Buddig Beef, 2 oz157​10452662​3​Sam's Choice, Pork, Spiral-Cut, Boneless, Brown Sugar Double Glazed Ham, 2.0 - 4.8lbs158​10413832​3​Hidden Valley Original Ranch Salad Dressing & Seasoning Mix, Gluten Free - 1 Packet159​44390971​3​Slicing Tomato, Each160​10452489​3​Great Value Finely Shredded Colby Jack Cheese, 16 oz161​10810980​3​Marie Callender's Pastry Pie Shells, 16 oz, 2 Ct (Frozen)162​15241047​3​Honeysuckle WhiteÆ Frozen Bone-In Turkey Breast with Gravy, 3-9 lb, Serves 2 to 6163​10315170​3​Great Value Original Diced Tomatoes with Green Chilies, 10 oz164​46908368​3​Birds Eye Steamfresh Super Sweet Corn, Frozen Corn, 10 Oz165​15136793​3​All Natural*, 73% Lean/27% Fat, Ground Beef, Roll, 3lbs, (Fresh)166​44390968​3​Small Bagged Avocado, 5-6 Count167​10849747​3​Smucker's Uncrustables Peanut Butter & Grape Jelly Sandwich, 4-Count Pack168​10448401​4​Great Value Butter Flavor Flaky Jumbo Biscuits, 8 Count169​10450118​4​Great Value Whole Vitamin D Milk, Half Gallon, 64 fl oz170​10534043​4​Great Value Pinto Beans, 15.5 oz Can171​10291535​4​Country Crock Original Spread Tub, 15 oz172​817042496​4​Great Value Steamable Mixed Vegetables, 12 oz173​44391360​4​Blue Bell Gold Rim Cookies 'n Cream Ice Cream Pint, 16 fl oz174​953466267​4​Great Value Medium Soft Taco Flour Tortillas, 17.5 Oz, 10 Count175​10320803​4​Shawnee MillsÆ Yellow Buttermilk Cornbread Mix 6 Ounce.176​44391042​4​Green Cabbage, Head177​10416105​4​Great Value Petite Diced Tomatoes in Tomato Juice, 14.5 Oz178​269796224​4​Great Value Ultra Paper Plates, 10", 50 Count179​10315162​4​Great Value Pure Granulated Sugar, 4 lb180​48534002​4​Honeysuckle WhiteÆ Fresh Bone-In Turkey Breast, 3-9 lbs, Serves 2-6181​10320937​4​Nissin Teriyaki Beef Flavor Chow Mein Noodles, 4 oz182​39778877​4​Great Value Seasoned Black Beans, 15 oz Can183​13893731​4​Marketside Shredded Iceberg Lettuce Salad, 8 oz184​981077201​4​Premium Grape Tomato, 10 oz Package185​20608050​4​Jimmy Dean Meat Lovers Breakfast Bowl, 7 oz (Frozen)186​10314968​4​Great Value Brown Gravy Mix, 0.87 oz187​22145407​4​Velveeta Original Melting Cheese Dip & Sauce (Classic Size), 32 oz Block188​44390971​4​Slicing Tomato, Each189​10813478​4​Totino's Party Pizza, Pepperoni Flavored, Frozen Snacks, 10.2 oz, 1 ct190​44390947​4​Fresh Zucchini Squash191​10794884​4​Marie Callender's Chicken Pot Pie, 10 oz192​10309449​4​Daisy Pure and Natural Sour Cream, Regular,16 ounces193​10295586​4​Velveeta Original Melting Cheese Dip & Sauce, 16 oz Block194​305034239​4​Freshness Guaranteed Homestyle Breaded Chicken Sandwich195​44390955​4​Tomato on the Vine, Bag196​10402987​4​Great Value Whipped Topping, 8 oz, Frozen Dessert Topping197​44391605​4​Fresh Strawberries, 1 lb198​19802852​4​GV All Purpose Flour 2LB Bag199​10402652​4​Cauliflower200​602240088​4​Sam's Choice Spiral-Cut Maple Pecan Flavored Double Glazed Ham, 8 - 13 lbs201​659879040​4​Great Value Steamable Whole Kernel Corn, 12 oz (Frozen)202​10415500​4​Great Value Tomato Sauce, 15 oz203​10801136​4​Cool Whip Original Whipped Cream Topping, 16 oz Tub204​10452423​4​Great Value Singles American Pasteurized Prepared Cheese Product, 16 oz, 24 Count205​51259378​4​Broccoli Crowns, per lb206​287474410​4​Tasteful Selections Honey Gold Potatoes, 24 Oz.207​21788698​4​Great Value Mild Diced Tomatoes with Green Chilies, 10 Oz208​155066735​4​Great Value Deli Style Sliced Pepper Jack Cheese, 8 oz, 12 Slices209​10450117​4​Great Value Fat Free Milk, Gallon, 128 fl oz210​16935929​4​Diet Coke Soda Soft Drink, 16.9 fl oz, 6 Pack211​44390958​4​Freshness Guaranteed Gala Apples, 3 lb Bag212​132893363​4​Great Value Sweet Cream Salted Butter, 16 oz213​10450115​4​Great Value 2% Reduced Fat Milk, 128 Fl Oz214​44391121​4​Great Value 1% Low Fat Chocolate Milk, Half Gallon, 64 fl oz215​19276135​4​Land O'Frost Premium Old World Style Black Forest Ham, 16 Oz.216​10314959​4​Great Value Cream Of Chicken Condensed Soup, 10.5 oz217​39103253​4​Slicing Tomato, 1 lb Tray218​44390943​4​Fresh Green Seedless Grapes, Bag219​10291107​4​Libby's Whole Kernel Sweet Corn, 15.25 oz220​10402652​4​Cauliflower221​824841960​4​All Natural*, 93% Lean/7% Fat, Lean Ground Beef, Tray, 1lbs, (Fresh)222​41752773​4​Lemons, each223​10448133​4​Jiffy Corn Muffin Mix, 8.5 Oz.224​707917491​4​REESE'S, Milk Chocolate Peanut Butter Trees Snack Size Candy, Christmas, 9.6 oz, Bag225​13812845​4​El Monterey Beef & Bean Burritos, 32 oz Family Size, 8 Ct (Frozen)226​19276183​4​Diet Dr Pepper Soda, 20 fl oz bottle227​44390945​4​Fresh Green Bell Pepper, Each228​415310707​4​(Hot) Freshness Guaranteed Rotisserie Chicken, Lemon Pepper, Cooked, Ready to Serve, 36 oz229​414519021​4​Bounty Select-A-Size Paper Towels, Double Rolls, White, 98 Sheets Per Roll, 2 Count230​10452489​4​Great Value Finely Shredded Colby Jack Cheese, 16 oz231​888875378​5​Lunchables Turkey & American Cheese ******* Stackers Kids Lunch Snack, 3.2 oz Tray232​10447842​5​Yellow Onions 3 lb Bag233​39103253​5​Slicing Tomato, 1 lb Tray234​132893363​5​Great Value Sweet Cream Salted Butter, 16 oz235​44391121​5​Great Value 1% Low Fat Chocolate Milk, Half Gallon, 64 fl oz236​15240705​5​Ocean Spray Whole Berry Cranberry Sauce, 14 oz237​44390992​5​Sweet Onions, each238​44390949​5​Hass Avocados, Each239​10306794​5​Bush's Pinto Beans, Canned Beans, 16 oz240​10534163​5​Great Value Evaporated Milk, 12 Fl Oz241​15570903​5​Maruchan Ramen Noodle Beef Flavor Soup, 3 Oz, 12 Count242​10308950​5​McCormick Brown Gravy Mix, 0.87 oz243​10324377​5​Fresh Mini Sweet Peppers, 16 oz bag244​51259402​5​Microwave-Ready Sweet Potato, each245​735585383​5​Great Value Broccoli Florets, 12 oz (Frozen)246​10447842​5​Yellow Onions 3 lb Bag247​415310707​5​(Hot) Freshness Guaranteed Rotisserie Chicken, Lemon Pepper, Cooked, Ready to Serve, 36 oz248​10534037​5​Great Value Traditional Refried Beans, 16 Oz249​51259427​5​Celery Sticks, 20 oz250​10292621​5​Premium Original Saltine *******s, 16 oz251​10315384​5​Great Value Spring Water, 1 gal252​10291833​5​Ranch Style Canned Pinto Beans, Real Western Flavor, 15 oz.253​10534107​5​Great Value ELBOWS, 16OZ254​11964663​5​La Banderita Soft Taco Large Flour Tortillas, 10 count, 16 oz255​10416105​5​Great Value Petite Diced Tomatoes in Tomato Juice, 14.5 Oz256​44390944​5​Fresh Roma Tomato, Each257​10314963​5​Great Value Taco Seasoning Mix, 1.25 oz258​100470326​5​Great Value Shredded Medium Cheddar Cheese, 16 oz259​1769223760​5​LB FLOUR TORTILLA BURRITO GRANDE 8CT260​44391605​5​Fresh Strawberries, 1 lb261​10321674​5​Campbell's Condensed Chicken Noodle Soup, 10.75 Ounce Can262​162577028​5​Navel Oranges263​10534037​5​Great Value Traditional Refried Beans, 16 Oz264​10313931​5​J.C. Potter Premium Pork Country Breakfast Sausage Roll, 16 oz265​10450115​5​Great Value 2% Reduced Fat Milk, 128 Fl Oz266​1769223760​5​LB FLOUR TORTILLA BURRITO GRANDE 8CT267​518517252​5​Freshness Guaranteed Pecan Pie, 23 oz268​150026057​5​PEZ Candy, Christmas Candy Dispenser, 3 Refills, 1 Count, 0.87 oz269​44390949​5​Hass Avocados, Each270​10452421​5​Great Value Shredded Low-Moisture Part-Skim Mozzarella Cheese, 16 oz271​47088918​5​Kraft Mexican Style Four Cheese Blend Shredded Cheese, 8 oz Bag272​513833154​5​Organic Thyme273​21553590​5​Beef Choice Angus Ribeye Steak, 1.5 - 2.6 lb274​44390964​5​Sweet Potatoes Per Pound275​24447268​5​Freshness Guaranteed 4" Mini Apple Pie, 4 oz276​403284742​5​Great Value 100% Pasteurized Orange Juice with No Pulp, 52 fl oz277​22282136​5​Philadelphia Original Cream Cheese, for a Keto and Low Carb Lifestyle, 2 ct Pack, 8 oz Bricks278​871036105​5​Great Value Chili Seasoning Mix, 1.25 oz279​10314928​5​Great Value Cherry Pie Filling or Topping, 21 oz280​12335110​5​Great Value All Natural Sour Cream, 8 oz Tub281​10450340​5​Great Value Ultra-Pasteurized Real Heavy Whipping Cream, 32 Oz282​981077201​5​Premium Grape Tomato, 10 oz Package283​10805116​5​Rhodes Yeast Dinner Rolls, 3 lbs, 36 Count Bag (Frozen)284​10308582​5​Rotel Mild Diced Tomatoes and Green Chilies, 10 oz


----------



## fjns (Dec 20, 2022)

Hi, see the linked file (with 15 auxiliary columns) for a possible solution...

The formulas used in the table:
D2: =A2&"#"&B2
E2: =IF(A2="","",COUNTIF(B$2:B2,B2))
F2: =RIGHT(V$1&B2,U$1)
G2: =COUNTIF(D$2:D2,D2)
H2: =COUNTIFS(A:A,A2,G:G,1)
I2: =IF(G2=1,H2&"#"&G2,"")
J2: =IF(G2=1,COUNTIF(I$2:I2,I2),"")
K2: =IF(G2=1,TEXTJOIN("#",,IF((A:A=A2)*(G:G=1),B:B,"")),"")
L2: =IF(G2=1,TEXTJOIN("#",,IF((A:A=A2)*(G:G=1),F:F,"")),"")
M2: =IF(G2=1,COUNTIF(K$2:K2,K2),"")
N2: =IF(G2=1,COUNTIF(K:K,K2),"")
O2: =IF(G2=1,RIGHT(T$1&MAX(H:H)-H2,S$1)&"#"&L2&"#"&ROW(),"")
P2: =IF(G2=1,IF(OR(H2=1,M2=1),O2,""),"")
Q2: =IF(G2=1,IF(H2=1,TEXTJOIN("#",,IF((A:A=A2)*(B:B=B2)*(K:K=K2),A:A,"")),IF(M2=1,TEXTJOIN("#",,IF((B:B=B2)*(K:K=K2),A:A,"")),"")),"")
R2: =IF(G2=1,IF(OR(H2=1,M2=1),COUNTIF(P:P,">"&P2),0),0)
S1: =LEN(COUNTIF(E:E,1))
T1: =REPT("0",S1)
U1: =MAX(LEN(IF(ROW(B:B)=1," ",B:B)))
V1: =REPT("0",U1)
W1: =MAX(R:R)+2
X2: =IF(ROW()>W$1-1,"",INDEX(K:K,MATCH(W$1-ROW(),R:R,0)))
Y2: =IF(ROW()>W$1-1,"",INDEX(Q:Q,MATCH(W$1-ROW(),R:R,0)))
Z2: =IF(ROW()>W$1-1,"",LEN(Y2)-LEN(SUBSTITUTE(Y2,"#",""))+1)

Combinations.xlsx


----------

