Excel challenge: Which combinations do columns have, and how many

snezana

New Member
Joined
Sep 4, 2014
Messages
20
Hi all,

So I have a nice challenge that I can't solve since I'm not a big excel expert.. hope someone can help me out!

So i have this product that is being sold. And a single product code (let's say the code is 0001) can have different entries in the columns that follow. E.g. if we sell a product with code 0001, there are 8 different extra options for that product that the consumer can buy. Sometimes people will choose the simple version of product 0001, but they can mix and match what they want added. e.g what type of material the product is made of, whether it can be adjusted yes or no, whether it has a expensive fabric or not... these options are reflected in columns 'Option 1' up until 'Option 8'.

Now what I need to find out is, for a particular product (here, 0001), which combinations of extra options appear, and how many times. I've made a hypothetical table below as an example to work with, but the actual data set would probably have 1000 rows for product 0001 alone.

As you can see there are many different options, and within those options there are a set number of options (which fortunately are always written in the same way so they are exact matches). I would like to create a list from this data saying, e.g.:

Combination name Combination content Number of times appeared
Combination 1 iron; 1; option 1.moves up; yes; regular; height and width adjustment; synchroon blokkering elke posi; partial5
Combination 2iron, plastic; 1; option 1, moves up; no; regular; height adjustment; synchroon blokkering elke posi; double6
Combination 3
Combination 4
etc...

<tbody>
</tbody>

So, it should (1) automatically make a list of combinations to show me WHICH combinations there are in the first place, and (2) then count the number of times that combination appear in the data set. I wouldn't be surprised if there were 20 different combinations.

Option 1Option 2Option 3Option 4Option 5Option 6Option 7Option 8
iron1option 1, moves upyesregularheight and width adjustmentsynchroon blokkering elke posipartial
iron, plastic1option 1, moves upnoregularheight adjustmentsynchroon blokkering elke posidouble
iron, plastic1option 1, moves upnoregularheight adjustmentsynchroon blokkering elke posinone
other1option 1, moves downnoregularheight and width adjustmentsynchroon blokkering elke posinone
other1option 1, moves upnoregularheight and width adjustmentsynchroon blokkering elke posinone
other1option 2, moves upnoregularheight and width adjustmentsynchroon blokkering elke posinone
other2option 1, moves downnoregularheight and width adjustmentsynchroon blokkering elke posinone
soft2option 2, moves upnoregularheight and width adjustmentsynchroon blokkering elke posinone
soft2option 1, moves upnoregularheight and width adjustmentsynchroon blokkering elke posinone
soft2option 1, moves upnospecialheight and width adjustmentsynchroon blokkering elke posipartial
soft2option 3yesspecialheight adjustmentsynchroon blokkering elke posipartial
soft2option 3yesspecialheight adjustmentsynchroon blokkering elke posipartial
soft3option 3yesspecialheight adjustmentsynchroon blokkering elke posipartial
soft3option 5yesspecialheight adjustmentsynchroon blokkering elke posipartial
iron, plastic3option 6yesspecialheight adjustmentsynchroon blokkering elke posidouble
iron, plastic3option 7yesspecialheight adjustmentsynchroon blokkering elke posidouble
iron, plastic3option 8yesspecialheight adjustmentsynchroon blokkering elke posidouble
iron3option 9yesspecialheight adjustmentsynchroon blokkering elke posidouble

<tbody>
</tbody>
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi, sorry for the late reply I shut down my computer early yesterday :)

From what i can gather this looks like something where you input the possible options, and it gives you back a list of possible combinations, right?

If so, what I want looks like this but is not the same. I already have a list of combinations. I have a list of let's say 100 rows, which is 100 customers buying a certain product but these products have different extra's added to them. From this list of 100 rows I want to have a smaller list returned that shows me what the common combinations are. So, which combination of options are people buying? Then, it should add to this list a count of how many times this combination of option appears.

So output, if we put it in the example of the chinese menu could be:

#NUMBER OF TIMES COMBINATION APPEARS
1DumplingsKung Pao ShrimpFried riceFortune Cookie50
2DumplingsKung Pao ShrimpFried riceIce Cream12
3DumplingsKung Pao ShrimpSteamed riceFortune Cookie11
4DumplingsKung Pao ShrimpSteamed riceIce Cream9
5DumplingsKung Pao ShrimpRice noodlesFortune Cookie10
6DumplingsKung Pao ShrimpRice noodlesIce Cream3
7DumplingsOrange BeefFried riceFortune Cookie2
8DumplingsOrange BeefFried riceIce Cream2
9DumplingsOrange BeefSteamed riceFortune Cookie1
10DumplingsOrange BeefSteamed riceIce Cream1
11DumplingsOrange BeefRice noodlesFortune Cookie5
12DumplingsOrange BeefRice noodlesIce Cream5

<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>
</tbody>

And input would be the actual list of combinations that people have ordered. So 50 rows of combination #1, 12 rows of combination #2, etc...
 
Upvote 0
how do you go from materials to food
 
Upvote 0
how do you go from materials to food


Since someone replied with an example of food x)


That's why the macro is so great, you can substitute whatever you like for food, and add/remove extra items (try it and see!)

But yes, that doesn't solve your problem here. You want a conditional count of the combinations after filtering them with remove duplicates or the advanced filter. Am I right?
 
Last edited:
Upvote 0
That's why the macro is so great, you can substitute whatever you like for food, and add extra items (try it and see!)

But yes, that doesn't solve your problem here. You want a conditional count of the combinations after filtering them with remove duplicates or the advanced filter. Am I right?

Yes that's what I'm looking for! Filtering with remove duplicates I can do, whatever comes next not so much...
 
Upvote 0
Ok, countifs is pretty easy to write, but rather than have so many formulas on the page you might consider setting a pivot table which will filter and count in one shot.
 
Upvote 0
Ok, countifs is pretty easy to write, but rather than have so many formulas on the page you might consider setting a pivot table which will filter and count in one shot.

How do I set the pivot to count all the combination, instead of the individual counts per option (so if i add the 8 options that are in 8 seperate columns, it counts the entries in the seperate columns, while i want a count of the combinations). I suspect this is not that difficult to do, but unfortunately I don't know..
 
Upvote 0
Actually I'm not sure if you can count identical row occurences in a pivot table. PowerPivot/Power Query may be able to (SQL can), and Excel 2013 has a new distinct count function but that may not apply here. The countifs formula goes like:


Excel 2010
ABCDEFGHIJ
1NameGroup1Group2Group3Group4Group5Group6Group7Group8
2Q1AAQWQEMMTUUPLFGPFLH
3W1AMMJAOWWDPJGCPBTRXF
4E3AWISEVYQXOATBJNPTQW
5R2SKAMCNUVKOOYRMMFUKQ
6T2SIXDUSJGGNSNDRFHPTD
7Q1AAQWQEMMTUUPLFGPFLH
8Q2ACDXGLOVDURLJBKZAFT
9E1AUGTHYDAABSBOKTHGRL
10R2SKAMCNUVKOOYRMMFUKQ
11R2SKAMCNUVKOOYRMMFUKQ
12
13
14NameGroup1Group2Group3Group4Group5Group6Group7Group8
15Q1AAQWQEMMTUUPLFGPFLH2
16W1AMMJAOWWDPJGCPBTRXF1
17E3AWISEVYQXOATBJNPTQW1
18R2SKAMCNUVKOOYRMMFUKQ3
19T2SIXDUSJGGNSNDRFHPTD1
20Q2ACDXGLOVDURLJBKZAFT1
21E1AUGTHYDAABSBOKTHGRL1
Sheet19
Cell Formulas
RangeFormula
J15=COUNTIFS($A$2:$A$11,A15,$B$2:$B$11,B15,$C$2:$C$11,C15,$D$2:$D$11,D15,$E$2:$E$11,E15,$F$2:$F$11,F15,$G$2:$G$11,G15,$H$2:$H$11,H15,$I$2:$I$11,I15)


which requires each column to be typed (an mmult formula might let you enter a single range)
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,612
Members
449,109
Latest member
Sebas8956

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