Extract that set which passes minimum 3 matches

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Using Excel 2010

Hello,

I got something in net I need an answer my head is broken how it is possible. There is some maths that is far beyond my knowledge.

There are 81 set of 4 numbers in the range C6:F86, out of these 81 sets there are only 9 unique set in the range I1:Q4, if I match these unique 9 with 81 sets there is 100 match of minimum 3 and max 4 match within these 9 sets.

To compare match there is formula in cells I6:Q6 which can be copied to down Q86.

Here is my question how and which formula or VBA has applied to bring these 9 unique those have match minimum 3 and 4 with all 81 combinations. Please help with this odd query.

Match Minimum 3.xls
ABCDEFGHIJKLMNOPQRS
1000111222
2012012012
3012120201
4021102210
5
600004        
700013
800023
900103
1000113
1100123
1200203
1300213
1400223
1501003
1601013
1701023
1801103
1901113
2001124
2101203
2201213
2301223
2402003
2502013
2602023
2702103
2802113
2902123
3002203
3102214
3202223
3310003
3410013
3510023
3610103
3710114
3810123
3910203
4010213
4110223
4211003
4311013
4411023
4511103
4611113
4711123
4811204
4911213
5011223
5112003
5212013
5312024
5412103
5512113
5612123
5712203
5812213
5912223
6020003
6120013
6220023
6320103
6420113
6520123
6620203
6720213
6820224
6921003
7021014
7121023
7221103
7321113
7421123
7521203
7621213
7721223
7822003
7922013
8022023
8122104
8222113
8322123
8422203
8522213
8622223
87
88
Sheet1
Cell Formulas
RangeFormula
I6:Q6I6=IF(SUMPRODUCT(--($C6:$F6=TRANSPOSE(I$1:I$4)))>2,SUMPRODUCT(--($C6:$F6=TRANSPOSE(I$1:I$4))),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I6:Q86Cell Value=4textYES


Thank you.

Regards,
Moti
 
Hello, in other word it can be said find out of 81 only those small sets which can guarantee minimum of 3 with all 81 sets. Please any VBA or formula help to solve this unusual task?

Thank you.

Regards,
Moti
 
Upvote 0
Hello, here is my explanation how I have found 9 set which has match minimum 3 (with each 81 sets)

Please help with VBA to find these matches 3 9 sets with all 81 sets ...

Match Minimum 3.xls
ABCDEFGHIJKLMNOPQRSTU
1Set1Set2Set3Set4Set5Set6Set7Set8Set9Count 2
20001112220<-----Formula Count If 2 In range S7:S87
3012012012
498101212020181<-----Total 81 match 1 per row
5SelectedTT:Sets021102210Count 1
6
7Set1Set100004        1<-----Formula Count Match only 1 In the Row
8Set2000131
9Set3000231
10Set4001031Thread has had 261 views yet nobody has offered anything. I assume the people didn't understand my explanation I guess this needs better explanation. Sorry for the inconvenience.
11Set5001131
12Set6001231
13Set7002031
14Set8002131
15Set9002231
16Set10010031
17Set11010131Since I summit the question I was trying to find the solution here is manually what I have come up…Need VBA to Find these 9 sets Automatically which has minimum 1 match per row 3 or greater.
18Set12010231
19Set13011031
20Set14011131
21Set2Set15011241
22Set16012031
23Set17012131Step-1, I placed the formula in S2 Count If Find 2 in the Range S7:S87 Step-2, Placed Formula in Range I7:Q87 Find Match >2iIn range C7:Q87
24Set18012231
25Set19020031
26Set20020131
27Set21020231Step-3, Filled Set1 in Range I2:I5 (0 0 0 0) that has 1 Match >2 With 9 Combinations, I7, I8, I9, I10, I13, I16, I25, I34 & I62
28Set22021031
29Set23021131
30Set24021231
31Set25022031Step-4, Placed Next Set2 in Range J2:J5 (0 0 0 1) and find in Range S2 Count = 3 I keep placing next sets till Count 2 = 0 which found set (0 1 1 2)
32Set3Set26022141
33Set27022231
34Set28100031
35Set29100131
36Set30100231Then Continued till find all 9 out of 81 that has matched >2….1 in each row total 81 match 9 with 4 and 72 with 3 all >2
37Set31101031
38Set4Set32101141
39Set33101231
40Set34102031
41Set35102131
42Set36102231
43Set37110031Please need VBA which can find these automatically Hope This Help
44Set38110131
45Set39110231
46Set40111031
47Set41111131
48Set42111231
49Set5Set43112041
50Set44112131
51Set45112231
52Set46120031
53Set47120131
54Set6Set48120241
55Set49121031
56Set50121131
57Set51121231
58Set52122031
59Set53122131
60Set54122231
61Set55200031
62Set56200131
63Set57200231
64Set58201031
65Set59201131
66Set60201231
67Set61202031
68Set62202131
69Set7Set63202241
70Set64210031
71Set8Set65210141
72Set66210231
73Set67211031
74Set68211131
75Set69211231
76Set70212031
77Set71212131
78Set72212231
79Set73220031
80Set74220131
81Set75220231
82Set9Set76221041
83Set77221131
84Set78221231
85Set79222031
86Set80222131
87Set81222231
Sheet5
Cell Formulas
RangeFormula
S2S2=COUNTIF(S7:S87,2)
S4S4=SUM(S7:S87)
I7:Q7I7=IF(I$2="","",IF(SUMPRODUCT(--($C7:$F7=TRANSPOSE(I$2:I$5)))>2,SUMPRODUCT(--($C7:$F7=TRANSPOSE(I$2:I$5))),""))
S7S7=IF(COUNTIF(I7:Q7,">0")=0,"",COUNTIF(I7:Q7,">0"))
Press CTRL+SHIFT+ENTER to enter array formulas.


Thank you.

Regards,
Moti
 
Upvote 0

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