Advanced combination search

mac_see

Active Member
Joined
Oct 15, 2002
Messages
419
Book1
BCDEFGHIJKLM
2Group1ABDEHTeam1ABC
3Group2ABGHJTeam2ABD
4Group3BCDHJTeam3ABE
5Group4BGHIJTeam4ACD
6Group5ABEFITeam5ACE
7Group6BCDEFTeam6ADE
8Group7AEGHJTeam7BCD
9Group8DEGHITeam8BCE
10Group9DEFHITeam9BDE
11Group10DEFGHTeam10CDE
12Group11CDEIJ
13Group12ACHIJ
14Group13BEFGJ
15Group14CDEIJ
16Group15ABDIJ
17Group16BCFGH
18Group17ACDEH
19Group18CDEFJ
20Group19BCDEI
21Group20BCDIJ
Workout


I am looking for formulas in the range M1:M11. The crieteria is:

I want to search in which group all the 3 team members were present.
Example:
In Team1 A B C together were not present in any of the 20 groups.
In Team2 A B D together were present in Group1, Group15.

I hope, I am very much clear in explaining this.

I thought of a workaround but my data has 500 Groups and unforunately I cannot get any way to achieve what I am looking for.

Maxi
 
Hi Maxi:

Did you get the right results? If you did get the right results, it sure is time to celebrate.

For understanding the logic of DATA Tables, if you use the reference that Aladin had pointed to, that will definitely help you get started. And the more you delve into EXCEL's capabilities, the better the understanding and it would continue to evolve. And please keep in mind -- at no point of development one has really arrived -- it is truly a journey.

Keep us posted with how it goes.

Happy New Year!
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Book1
ABCDEFGHIJKLMNOPQRSTUVW
1Field1F1F2F3F4F5F6F7F8F9F10
2Group1ABCDEFGJKL
3MNPQRSTUVZonevariable
4Group2ABDGHIKLNODataTable
5PQRSTUWXYZTeamCount
6Group3ABDEFJKLMNTeam1PQRSTUVPQRSTUVPQRSTUV
7OPQRSTUVXYTeam2ABCDEFGABCDEFGABCDEFG
8Team3ABDEFJKABDEFJKABDEFJK
9Team4CDEFGHICDEFGHICDEFGHI
10Team5LMNOPQRLMNOPQRLMNOPQR
Sheet3


Hi! Yogi,

I thought of making a difficult task and I made it but stuck again at the SUMPRODUCT formula. Frankly speaking I did not understand the LOGIC behind this solution. If you can answer this question, I might make myself clear of the logic after analyzing both the solutions.

Thanx
Maxi
 
Upvote 0
Hi Maxi:

Let me try explaining it my way in pseudo-technical terms. A DATA Table solution is based on the fact that I am going to setup a starting pattern on how to solve it for the first item in my list of various items that I need to solve it for.

For example in our case, I set up a pattern for solution for getting a count of how many times the combinations of the constituents of Team1 appeared in our database that was presented in cells B1:G21. Successfully setting up this pattern is the crucial part -- because once the pattern is made, EXCEL can be asked to implement it for my remaining teams. Now setting up the pattern may be simple, or it may be a non-trivial task requiring some modifications to help setup a pattern such that EXCEL is able to replicate it for other variables -- in our case for Teams 2 through 10.

Now let us look at how I had set up the pattern. If I want to tell EXCEL to be able to make a count of the Team1 entries in the database, EXCEL has no clue what to do -- so I have to set up a pattern in terms that EXCEL can understand. This is how I went about it ...

In our original example each team consisted of three players, and each team had three different players, and the database Groups had upto 5 players in each group. So this is how the SUMPRODUCT formulation was set up ...

First find if a player in Team1 is found in a Group of the database -- this is a necessary condition, but not a sufficient condition; so we look at next if on matching the 3 players of a team in the 5 players of a group, if out of the 5 players in the group, 3 of them matched with the players of Team1, then all 3 players of Team1 were part of that group. So you can see now how the SUMPRODUCT formulation consists of matching all the players of Team1 with all the players in Group of the first record of the database, and if the number of matches is =3, then we have a success, ... otherwise we move on the next record in the database, and so on.

What we have done so far made up the criterion to see if a particular record in the database included all the players of Team1.

Then we move on to the next part -- it is not enough to just find out if one, more than one, or none of the records in the database successfully met the criterion we had setup. We must also count how many times success was encountered -- that is how many records met our criterion -- and that translates to how many times the players of Team1 appered in the records of the database. This is how we do this part ...

We set up a formula using the DCOUNTA function that helps us make a count of all the records in the database that met out criterion that was setup in cells N1:N2

Now this is all fine and dandy -- but this is only for Team1. But we need to do this for all the other teams Team2 through Team10 as well. This is where EXCEL comes to our rescue -- and since I have setup the pattern, I can now now use the DATA Table feature to have EXCEL do that for all the other teams.

You will notice that in setting up the DATA Table, we gave EXCEL a formula to implement using the criterion we had set up. We gave EXCEL a list of all the Teams for which to use that formulation. The reason we have to tell EXCEL about the Column_input_cell is -- because this becomes a staging area for EXCEL, where EXCEL temporarily puts the name of the Team it is working with, thus using the pattern for that team, get the results, move on the next team, use the pattern, and so on.

I hope this gives you a clearer picture on how the DATA Table worked on the Teams in your original post.

Are you now able to use it for the make up of your new teams?
 
Upvote 0
dddddddddddddddddddddddd.xls
BCDEFGHIJKLMNO
1Field1Field2Field3Field4Field5Field6
2Group112458FALSE
3Group2127810onevariable
4Group3234810DataTable
5Group4278910Team0
6Group512569Team11231231232
7Group623456Team21241241244
8Group7157810Team31251251253
9Group845789Team41341341346
10Group945689Team51351351354
11Group1045678Team61451451455
12Group11345910Team72342342344
13Group12138910Team82352352352
14Group13256710Team92452452453
15Group14345910Team103453453456
Sheet1


Thank you for the explanation Yogi. I guess I will have to get home and read it. Cannot do it in the work place.

One more interesting thing that has hit my mind. I was just manipulating the data and I ended up converting the text into integers and whoops! the result is not the same???

Earlier it was:
0 2 2 1 1 2 4 2 3 6

Now it is:
2 4 3 6 4 5 4 2 3 6

Maxi
 
Upvote 0
"mac_see]
....
One more interesting thing that has hit my mind. I was just manipulating the data and I ended up converting the text into integers and whoops! the result is not the same???

Earlier it was:
0 2 2 1 1 2 4 2 3 6

Now it is:
2 4 3 6 4 5 4 2 3 6

Maxi
Hi Maxi:

Every thing is cool! -- the results would be right if the changes you make would be acceptable. Recall that our pattern was setup to compare character by character, or for that matter digit by digit. Now so far so good -- we substituted each characte with a corresponding digit -- Right? Yes except for the leter J, we substituted it with a two-digit number 10.

You will see in the following illustration, I have substituted J with another character ~, and the results are consistent ...
y031227h1.xls
BCDEFGHIJKLMNO
1Field1Field2Field3Field4Field5Field6
2Group112458FALSE
3Group21278~onevariable
48~DataTable
5Group42789~TeamCount
6Group512569Team11231231230
7Group623456Team21241241242
8Group71578~Team31251251252
9Group845789Team41341341341
10Group945689Team51351351351
11Group1045678Team61451451452
12Group113459~Team72342342343
13Group121389~Team82352352352
14Group132567~Team92452452453
15Group143459~Team103453453456
Sheet4b (2)


Good Luck with your exploration!
 
Upvote 0
Hi! Yogi,

Do you mean to say that there is no way to get the correct results if I put a two digit number (10 in this case)?

Maxi
 
Upvote 0
mac_see said:
Hi! Yogi,

Do you mean to say that there is no way to get the correct results if I put a two digit number (10 in this case)?

Maxi
Hi Maxi:

I suggest you read/re-read the writeup I gave you on setting up the criterion (in our case using the SUMPRODUCT formulation) -- and you will discover that we are comparing character by character or digit by digit.

So, this will mean -- the answer is No! you can not use a two-digit number to compare with a single-digit or a single character in the formulation.

However, after having said that the answer is NO!, if you can explain what you are trying to do, there may be very simple work-arounds -- one of which I have already used in my last illustration.

And in the bigger scheme of things, depending on what you are working on, and what sort of things you will be doing with this data, you may even want to look at whether this is the best layout of the data for your project, or should you consider arranging the data in some other fashion.
 
Upvote 0
I have just read through, with interest, the solutions and explanations provided with respect to Mac See's problem. I am interested in the matter with a little bit of twist.

In Just Jon's post No. 2 - in reply to Mac See's original request, he wrote:
Do you want A] a yes/no answer, or B] a group name, or C] all matching group names, or D] something else entirely as I've missed the point? <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>

My question is this: given the same problem, what would be the solution if e.g. I want the result to return the row numbers containing the matching groups. In the example, the groups are housed in Rows 1 to 15. It is these row numbers that I'd prefer in column 'O'.

In other words, instead of returning the count of 2, 1, 3, 6 etc. in column 'O', it is the row numbers of the matching groups that I would want in column 'O'.

Any suggestions would be appreciated, please.

Thanks.

Kenny
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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