Unique groups of two numbers, all numbers in a unique group

dtaylor646

New Member
Joined
Jun 12, 2018
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

Though some other posts have had similar solutions, I want to pair a list of unique identifiers to others with each pairing unique for each month. April has #1 with #3 and necessarily #3 with #1 The first three pairings were manual and would like a formula to generate the other pairings for other months, where the pairings do not repeat from the previous months' pairs. Thank you for any and all help!

[TABLE="width: 500"]
<tbody>[TR]
[TD]Identifier[/TD]
[TD]April[/TD]
[TD]May[/TD]
[TD]June [/TD]
[TD]July[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]4[/TD]
[TD][formula here][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]4[/TD]
[TD]1[/TD]
[TD]3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]7[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]14[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]20[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]11[/TD]
[TD]10[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]12[/TD]
[TD]9[/TD]
[TD]11[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]9[/TD]
[TD]12[/TD]
[TD]10[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]10[/TD]
[TD]11[/TD]
[TD]9[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]19[/TD]
[TD]14[/TD]
[TD]15[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]20[/TD]
[TD]13[/TD]
[TD]6[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]17[/TD]
[TD]16[/TD]
[TD]13[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]18[/TD]
[TD]15[/TD]
[TD]17[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]15[/TD]
[TD]18[/TD]
[TD]16[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]16[/TD]
[TD]17[/TD]
[TD]19[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]13[/TD]
[TD]20[/TD]
[TD]18[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20[/TD]
[TD]14[/TD]
[TD]19[/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
The formula vs. macro logic seems similar. Make a set of possible values, randomly choose one, then repeat for the next row. If you run out of possibilities, try again from the top. For a formula, that's F9, for my macro I loop, up to 1000 times. I was a little surprised at how few times I needed to loop, even when looking at 19 columns.

Incidentally, nice formula!
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hello Marcelo, It looks like the formula is working as I individually add columns to the right. If I do not paste-value the new column before adding another, the numbers will regenerate and create new pairs of combinations. I mention this not as a criticism, but for anyone who may use the formula above for their own paired-grouping in the future.

Eric, I am new to VBA and look forward to trying your solution as well to continue to grow in that dimension. I love that in Excel there is more than one solution! Thank you all!! -Dan:biggrin:
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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