A feature to create pairs of combinations

bansche123

New Member
Joined
Dec 9, 2019
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Dear Forum Users,

In the file “Combi Pairs” there are three worksheets.

The first is titled “1st combi”. In this worksheet you can find combinations in columns ranging from B to G. The combinations consist of sets numbered from 1 to 14. S1 means the first set, S2 the second and so on. So, technically, the combinations should look like, for instance — S1, S2, S5 instead of just 1, 2, 5. That is why in the A column there is an “S” before each combination, just as a reminder that the numbers in the combination indicate sets. The 14 sets are to be found in columns from I to V. Each of the 14 sets has got six slots for numbers. The sets are filled with different amounts of numbers while some aren’t filled with any. D1 and G1 are also sets of numbers however, these are separate sets and will be described later in more detail.

The second worksheet is titled “2nd combi” and in its structure it’s identical to the “1st combi” worksheet. The differences are:
  • the combinations — there are more and varying combinations in comparison to the “1st combi” worksheet
  • the numbers in the 14 sets — there are differently distributed among the sets, as well as there are new/other numbers, that weren’t present in the sets in the “1st combi” worksheet
  • both sets D1 and G1 have different numbers inside of them
The third worksheet is titled “Pairs”. That will be the whole point of my thread. In the future in this worksheet I would like to make pairs of combinations (one combination from “1st combi” and one combination from “2nd combi”) appear. Obviously there are going to be conditions under which these pairs shall be formed. I will describe these requirements below.

"Pairing", does not mean directly merging or combining but simply displaying the two combinations together but separately, e.g. with a "+" sign in between.

The pairing of two combinations must take place under some conditions and this is exactly what the numbers in the Sets are necessary for. I will try to explain the whole process with an example. Let's say the feature has to decide whether the combination 1, 3, 5, 10 (I combination) from “1st combi” (yellow background, 25th row) may be paired with combination 2, 3, 9, 13 (II combination) from “2nd combi” (yellow background, 65th row). To determine this, the feature must compare the numbers assigned to the Sets: S1, S3, S5, S10 in worksheet “1st combi” with the numbers assigned to the Sets: S2, S3, S9, S13 in “2nd combi”. I have created a table with the comparison. (attach. Tab. 1 ENG)

Tab 1 ENG.jpg


A number of things can arise here:

1. The first step is to compare if and which numbers occur in the sets, that both combinations are made of. In principle, the basic requirement to form a pair is that — in each Set of the first combination, at least one number occurs, that is found in a Set of the second combination. The numbers with a yellow background (in Tab. 1 ENG) are found in Sets in the first combination as well as in the Sets in the second combination. The numbers with the red background represent other options of numbers found in Sets that both combinations are made of, but it is sufficient if only one number is common, such as 29 in the case of S5 (I combination) and S13 (II combination). Of course, the feature can and should also recognize 16 as a common number, but this is not absolutely essential for the final result, i.e. for the formation of combination pairs.

2. If a Set is to be used twice, e.g. in the first combination we would have: S1, S1, S3, S5, S10 (1,1, 3, 5, 10). In this situation, two numbers from the S1 set can be used to find identical numbers in the Sets of the II combination, e.g. the 5 in S2 and the 2 in S3. Conversely, if a set occurs only once in a combination, this means that at most only one number from the set is available. In the example, for instance, since P10 is contained only once in the I combination: "P1, P3, P5, P10", a maximum of only one number from: 11, 33 may be taken into account.

3. IMPORTANT! In point 1, I described that at least one number from each individual Set of the I combination must occur in a Set of the second combination. There is one exception to this. If a combination of Sets is created, then the other sets (which are not contained in the combination) are automatically not taken into account. These sets, that are not taken into account, also have numbers assigned to them. Since the Sets in both combinations are equipped with different numbers, but some (quite a few) of these numbers are the same, the only difference is that they are to be found in other Sets, it can happen that a number that occurs, for example, in the Sets of the I combination, does not occur at all, in all the of Sets, which the second combination could be made out of. I have also prepared a table for this. (attach. 2 Tab.2 ENG)
Tab 2 ENG.jpg

Hypothetically, if the number 18 did not exist in S3 of the I combination, then there would be no number at all in the S3 set that also occurs in the Sets from the second combination. According to the first point, one would therefore have to stamp the I combination as not suitable for pair formation. If, however, a number such as 3 or 8 (yellow background, Tab. 2) does not occur in any Set that is available to create the second combination, then the *first* combination may still be used to form a pair.

D1 and G1 are Sets which are also filled with numbers. These numbers shall be used in the further filtration of the pairs. So, for example, making a feature that would allow to only show pairs of combinations in which a number from D1 or G1 has been the number that allowed to form a pair. Another great feature would be to limit the amount of the identical sets used in both combinations forming pair, so when it is equal to max. 2 then for instance a pair like 1, 2, 3, 10 + 1, 2, 3, 14 would not be possible.

Combi Pairs.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXY
1Combinations (1st list)S1S2S3S4S5S6S7S8S9S10S11S12S13S14D1G1
2S125215148287172311201213
3S129519314925333146
4S131013261827161214
5S145223521292123
6S151024322325
7S2310
8S248
9S2410
10S268
11S2610
12S2612
13S2712
14S3512
15S369
16S3612
17S3712
18S4512
19S4710
20S569
21S1269
22S12710
23S12811
24S13410
25S13510
26S13610
27S13710
1st combi


Combi Pairs.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXY
1Combinations (2nd list)S1S2S3S4S5S6S7S8S9S10S11S12S13S14D1G1
2S14714215131930171861421163262
3S1411759332235232098
4S151010112824291111
5S17101227312527
6S241026
7S2412
8S2414
9S2514
10S2712
11S347
12S349
13S3411
14S3512
15S3712
16S4512
17S4710
18S4714
19S569
20S5611
21S5614
22S5714
23S6712
24S6714
25S1247
26S1249
27S12411
28S12510
29S12710
30S121013
31S1347
32S13410
33S13710
34S131011
35S131013
36S1467
37S14611
38S1479
39S14710
40S14713
41S14811
42S14911
43S14913
44S141011
45S141013
46S141213
47S1569
48S15610
49S15810
50S15811
51S15910
52S151011
53S16710
54S16711
55S16713
56S16911
57S161011
58S161013
59S161213
60S17810
61S17811
62S17910
63S171213
64S23912
65S23913
66S23914
67S231012
2nd combi



Combi Pairs.xlsm
ABCDEFGHIJKLMNOP
1combination from 1st list +combination from 2nd list
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16
17
18
19
20
21
Pairs
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Need to create pairs of combinations
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Cross posted at:
 
Upvote 0
Unfortunately, I have only now noticed that I have forgotten to describe a detail in the paragraph that occurs after the Tab. 2 ENG. I have now added the information in the paragraph. To make it more recognizable I have written it with large letters.

Hypothetically, if the number 18 did not exist in S3 of the I combination AND IN THE SECOND COMBINATION, SET S9 WOULD NOT BE PRESENT, then there would be no number at all in the S3 set that also occurs in the Sets from the second combination. According to the first point, one would therefore have to stamp the I combination as not suitable for pair formation. If, however, a number such as 3 or 8 (yellow background, Tab. 2) does not occur in any Set that is available to create the second combination, then the *first* combination may still be used to form a pair.
 
Upvote 0
Hi,​
unfortunately you also forgot to attach the expected result ! …​
 
Upvote 0
Hi,​
unfortunately you also forgot to attach the expected result ! …​
Well, I have (in detail) described how the result should look like + I gave an example of a result, so a pair of combinations that fits the requirements, namely the pair: 1, 3, 5, 10 + 2, 3, 9, 13

It's impossible for me to give every single result, because my brain would explode trying to find all possible pairs of combinations. That is exactly why I reached out to the forum.
 
Upvote 0
So hope someone could decypher your need …​
 
Upvote 0
Another point : according to Excel what kind of 'feature' are you expecting for ?​
 
Upvote 0
Another point : according to Excel what kind of 'feature' are you expecting for ?​
TBH whatever will simply work. If it's possible to do with formulas, then why not, the same goes for a macro.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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