Find Duplicate Combinations

Aqil

New Member
Joined
May 5, 2011
Messages
9
I'm trying to list all of the unique combinations of five playing cards from a standard deck of cards, and it's taking up more space and computing power than I could ever imagine. But let's just start with a three card combination. There are not enough rows, so I'm getting a huge matrix. So I'm trying to find ways to eliminate the combinations I don't need.

The data for the first three cards looks something like this (somewhat simplified):

Code:
A	B	C
3	2	1
4	2	1
5	2	1
...
51	1	5
52	1	5
1	2	5
3	2	5
...
48	51	52
49	51	52
50	51	52

There are 52 unique cards in a deck, hence all data points are coded as integrals 1-52, but can obviously be transformed to something more intuitive later. I have removed all combinations including the same number more than once, such as 50,52,52 , because the same card can't be drawn twice. I basically just used IF functions for this.

But I still have many redundant combinations that are equal to some other equivalent combination. For example, the combination 5,2,1 is equivalent to the combination 1,2,5. After all, it doesn't matter in which order the cards are picked, so only one of the combinations need to stay. So my question is how to remove all the duplicate combinations in my data set?

I'm using Gnumeric or LibreOffice Calc on a Linux OS at home so I'd prefer if the task can be done without VBA coding and add-ins. I have access to the real deal (Excel) at my university, but then I'd have to wear pants and expose myself to dangerous daylight. Besides, the easily implemented formulas in an intuitive spreadsheet interface is what I love about Excel.

Any bright ideas?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Never mind, I think I can answer my own question now. It's so obvious once you know how to do it. So sorry for wasting space and time. Hope it'll be useful for someone else whom might have a similar issue.

D column:
=if(if($A2>$B2,1,0)*if($B2>$C2,1,0)=1,A2,"")
E column:
=if(if($A2>$B2,1,0)*if($B2>$C2,1,0)=1,B2,"")
F column:
=if(if($A2>$B2,1,0)*if($B2>$C2,1,0)=1,C2,"")

This will remove all rows that are not in descending order, leaving only the rows that are consistently in descending order. So any combination can only occur once.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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