Creating Rosters/registers

Carvell

New Member
Joined
May 21, 2016
Messages
17
Hello,
I have a table which tells me which class a student is in

[TABLE="width: 248"]
<colgroup><col><col span="4"></colgroup><tbody>[TR]
[TD]Student[/TD]
[TD]Group1[/TD]
[TD]Group2[/TD]
[TD]Group3[/TD]
[TD]Group4[/TD]
[/TR]
[TR]
[TD]StudentA[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]StudentB[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]StudentC[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]StudentD[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]1
[/TD]
[/TR]
</tbody>[/TABLE]

I would like to change this into a list of students in each class

[TABLE="width: 512"]
<colgroup><col width="64" style="width:48pt" span="8"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Class[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]1[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]2[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]3[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]4[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]5[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]6[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]7[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Student[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]

Below each number I would like a list of the students in that class

So below class 1 it would say StudentA and then the row below would say StudentD

I can create the lists using COUNTIF but I end up with blank rows (which I don't want)

Is there a formula, that can make this from the table above?

[TABLE="width: 512"]
<colgroup><col width="64" style="width:48pt" span="8"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Class[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]1[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]2[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]3[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]4[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]5[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]6[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]7[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]Student[/TD]
[TD="bgcolor: transparent"]StudentB[/TD]
[TD="bgcolor: transparent"]StudentA[/TD]
[TD="bgcolor: transparent"]StudentA[/TD]
[TD="bgcolor: transparent"]StudentA[/TD]
[TD="bgcolor: transparent"]StudentC[/TD]
[TD="bgcolor: transparent"]StudentA[/TD]
[TD="bgcolor: transparent"]StudentD[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]StudentD[/TD]
[TD="bgcolor: transparent"]StudentC[/TD]
[TD="bgcolor: transparent"]StudentB[/TD]
[TD="bgcolor: transparent"]StudentB[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]StudentC[/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"]StudentD[/TD]
[TD="bgcolor: transparent"]StudentD[/TD]
[TD="bgcolor: transparent"]StudentC[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
</tbody>[/TABLE]

Thank you
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
How about


Excel 2013/2016
ABCDEFJKLMNOPQ
1StudentGroup1Group2Group3Group4Class1234567
2StudentA2346StudentStudentBStudentAStudentAStudentAStudentCStudentAStudentB
3StudentB3417StudentDStudentCStudentBStudentBStudentCStudentD
4StudentC6542StudentDStudentDStudentC
5StudentD2371
Sheet2
Cell Formulas
RangeFormula
K2=IFERROR(INDEX($A$2:$A$5,AGGREGATE(15,6,(ROW($A$2:$A$5)-ROW($A$2)+1)/($B$2:$E$5=K$1),ROWS($A$1:$A1))),"")
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
That’s okay.

Is it possible to explain how it’s working.

Also, I’m pretty sure this is moving into the world of VBA (which I have no understanding). Is it possible from my original table to make a new worksheet for each unique class name and then add the student list?

Thanks
 
Upvote 0
This part of the formula
(ROW($A$2:$A$5)-ROW($A$2)+1)
returns an array of of numbers {1;2;3;4} representing the rows so A2 is the 1st row A3 the 2nd etc
This part
($B$2:$E$5=K$1)
returns an array of TRUE or FALSE depending on whether a cell matches the criteria in K1
The array of rows is then divided by the array of true/false which gives either a Div0 error or the row number.
This parrt
ROWS($A$1:$A1)
returns the number of rows, so in K2 it returns 1, in K3 it returns 2etc
This
AGGREGATE(15,6,...
Is the same as the SMALL function except it ignores errors, so in K2 it will return the smallest non error value.

If you select the cell with the formula & click "Evaluate Formula" on the Formulas tab, you can see it working each part out.

You will need to start a new thread for your other question.
 
Upvote 0

Forum statistics

Threads
1,223,757
Messages
6,174,327
Members
452,555
Latest member
colc007

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