Course selection

taniab

New Member
Joined
Jun 8, 2015
Messages
42
So we have a list of all students and their course selections.
there are five main "pathways" they can choose and then they select 6 courses.

There student ID is listed and then True in any ONE of the pathways
Untitled Spreadsheet

ATARGeneralVIPGenViIPFoundProfile

then after that will be listed "true" for each of their course selections

I want another table with formulas or a macro, that will list
the first student
The pathway code that has True Selected against it
Course selection 1 (the first one that has "True"
Course selection 2
Course Selection 3
Course selection 4
Course Selection 5
Course selection 6

Then the next student record on the next row


So essentially it looks at each colum, asks if there is a "true" in it, if there is it lists the name of the colum and then moves tot he next colum. If no "True" it skips and checks the next colum until it reaches the end of the row.
 

Attachments

  • course selection.JPG
    course selection.JPG
    110.9 KB · Views: 10

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hello,

Does this work as expected?

Code:
Sub COURSE_TABLE()
    Application.ScreenUpdating = False
    With Sheets("Sheet1")
        For MY_ROWS = 2 To .Range("A" & Rows.Count).End(xlUp).Row
            MY_STUDENT = .Range("A" & MY_ROWS).Value
            Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Value = MY_STUDENT
            For MY_COLS = 3 To .Cells(1, Columns.Count).End(xlToLeft).Column
                If .Cells(MY_ROWS, MY_COLS).Value = True Then
                    MY_COURSE = .Cells(1, MY_COLS).Value
                    Sheets("Sheet2").Range("IV" & Range("A" & Rows.Count).End(xlUp).Row).End(xlToLeft).Offset(0, 1).Value = MY_COURSE
                End If
            Next MY_COLS
        Next MY_ROWS
    End With
    Application.ScreenUpdating = True
End Sub

You will need to change sheet references, to your tab names.
 
Upvote 0
@taniab

I suggest that you
  • update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
  • investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,039
Members
449,063
Latest member
ak94

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