Forum Discussion
Change the layout of my data
- Oct 14, 2021
I suggest to add an additional sheet2 and enter the unique course descriptions in range A1:DJ1 (if there are 114 descriptions altogether).
Then you can enter below formula in A2 and fill over to DJ2:
=FILTER(sheet1!$A$3:$A$153;(sheet1!$C$3:$C$153=sheet2!A1)+(sheet1!$D$3:$D$153=sheet2!A1)+(sheet1!$E$3:$E$153=sheet2!A1)+(sheet1!$F$3:$F$153=sheet2!A1)+(sheet1!$G$3:$G$153=sheet2!A1))
Formula so far covers range for course1, course2 , course3, course4 and course5 which is column C, D, E, F and G in sheet1 but can easily be adapted to the remaining columns H to Q.
Ashley PowerQuery would be the easiest way out here. But, what you ask for will create a table with 45 rows and 218 columns, similar to OliverScheurich 's formula based solution. Personally, I would prefer the table with the Course names down one column (i.e. 218 rows) and the 45 columns with student ID's. But, that's up to you, of course.
The attached file contains both options. The queries are static and run off the dataset in your file. For now, it will not work if you add students or courses to the data, but with a few extra steps it can be made dynamic. Just didn't go all the way. This is just an example of what's possible.
By the way, I deleted the hidden sheets from your original file. They included links to other workbooks that disturbed matters quite a bit when opening and saving the file.
- AshleyOct 20, 2021Iron ContributorI have not been able to get this solution out of my head. It's brilliant! Change the column headers to student IDs and rows to course names.
However, our business school is growing exponentially. Therefore, the number of students in the program may one day outnumber the number of courses.- Riny_van_EekelenOct 20, 2021Platinum Contributor
Ashley Fair enough! But even when you will have 1000 students and 500 courses, I guess it's unlikely that any given course will have more than 500 students. In your own example with 152 student, the most popular course had 45 participants. That's why I proposed the alternative (vertical) lay-out. Changing column names takes a few seconds and making it fully dynamic, perhaps a few minutes.
- AshleyOct 20, 2021Iron Contributor
Good point! It's safe to say OliverScheurich had the best answer to my question, but Riny_van_Eekelen your addition is the Best Upgrade.