Maximum number of pairings

Pompey_Dan

New Member
Joined
Jan 27, 2011
Messages
1
Hi,

First time poster here and desperately in need of some help!

I have a long list of applicants that have been matched using various criteria, however, some of these applicants have multiple matches and I need to determine the maximum number of pairings that could be achieved.

Example:

1st ApplicantMatched Applicant
Applicant AApplicant B
Applicant AApplicant C
Applicant BApplicant A
Applicant BApplicant C
Applicant CApplicant A
Applicant CApplicant B

In the example there are three possible matches (A with B, A with C, and B with C) but the maximum number of pairings is one because Applicant A can only be matched with one of Applicant B or Applicant C, leaving the other (B or C) without a pair.

There are 1186 rows of data in my worksheet, and a total number of 593 potential matches, but I need to determine the maximum number of pairings that could be achieved (which I expect to be far lower than 593)... think of it like a dating agency at work, pairing up potential couples in an attempt to clear it's books (although what I'm trying to do is far more mundane!!)

Any help would be much appreciated, thank you.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Welcome to the Forum!

There are 1186 rows of data in my worksheet, and a total number of 593 potential matches ...
Ir will be fewer than that. Suppose you have 6 applicants, and each is happy to partner with the other 5. If you list them as you have done, you'll have 6 x 5=30 lines, but a maximum of 3, not 15, matches.

Can you please let us know in your Account details what version of Excel you're using? If you have the latest version, it may be feasible to do this with formulae - perhaps using a recursive LAMBDA.

But I'd do this in VBA. Is that an option for you?

If so, here's how I'd structure this:

ABCDEFGHIJKLM
1BCDEF
2AxxxPair Possibilities --->
3Bxx1ABACACADAD
4Cx2CEBDBFBFEF
5D3EFCE
6Ex
7F
8
Sheet1

The table shows that:

- A is a match for B, C and D.
- B is a match for D and F (we don't need to show the A-B match again)
- etc etc

So the code simply needs to loop through the possibilities:
Pair 1: Match A with B, C or D
Pair 2: For each of the three Pair 1 possibilities, make a second match out of the remaining possibilities.
Pair 3: For each of the Pair 1/Pair 2 possibilities, make a third match out of the remaining possibilities.

The resulting list to the right shows there are two ways to make three matches for this group.

In a bigger more complicated example, we'd also need to allow for people not to be matched. So the first pair here would be AB, AC, AD or A-unmatched, because A-unmatched could lead to the greatest number of pairings in a longer example.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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