Possible combinations Or Pivot student exam program

Phantom1

New Member
Joined
Sep 26, 2018
Messages
24
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Lets say i have a data set with five columns with subject name for every student and need to create a program for exams.

Mark A B C F
Paul K C L A
Jane B F D A
George M N C E

I need to find the best way to combine all letters so that no student has two exams the same day.
For example the subject A cannot be in the same day with B,C,D,F,K or L.

A possible solution (output) would be
Day 1 : A,E
Day 2 : B,K,M
Day 3 : C,D
Day 4 : F,L,N

This solution is not unique. All we need is to find this result for the smallest amount of days.
If we could choose somehow the maximum number of subjects that can be grouped in a day would be perfect.

A pivot table could help . An approach I tried , was by finding the number of students for every two subject pair.

For example
A B C D E F K L M N
A - 2 2 1 0 2 1 1 0 0 from here we can see that A has no conflict with E,M or N. But a group of A,E,N is not acceptable (see George)
B 2 - 1 1 0 2 0 0 0 0
C 2 1 - 0 1 1 1 1 1 1 from this line we see that C can be grouped only with D
D
E the rest are completed
F as explained
K
L
M
N


Hope I was clear about my problem.
Suppose that I have a data set of a thousand students.

Any help would be appreciate.
Sorry for being a novice at this.

Thanks in advance
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Because I didn't get any answer let me rephrase my problem.

I want a VBA code to find all groups of the letters so that no letter is on the same row with any other in the group.


For example, for the data given above.
because A is on lines 1,2,3 can be grouped with only one subject that is only on line 4. This subjects are E,M,N

An output could be

Groups with A : AE, AM, AN
Groups with B : BEK, BEL, BKM, BKN, BLM, BLN
Groups with C : CD
Groups with D : CD, DKE, DLE

..
etc.

Thanks again !!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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