Change the layout of my data


I would like to change the layout of my data from the course data for each student ID showing up in rows to course data being listed at the top in column headers and student IDs below. Sample file attached.


How do I do that?

Change From

Student IDCourse 1Course 2Course 3
22021 FA2 MBA 5042021 FA2 MBA 5622022 SP1 MBA 514
32021 FA1 BAN 5002021 FA2 MIS 5922022 SP1 BAN 501
42021 SU1 MBA 5162021 SU2 MBA 5042021 FA1 MBA 508

Change To

2021 FA1 MBA 5082022 SP2 MIS 5032023 SP1 MBA 5322024 SP1 MBA 516




Any ideas are greatly appreciated,

Ashley Adams


15 Replies
best response confirmed by _yoAshley_ (Contributor)


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:


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.




@_yoAshley_ 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 @Quadruple_Pawn '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.

The next step in the process is data entry into a registration system. From the preview, it looks like we would need the blank cells removed.
The graduate school coordinator and I feel confident we can do this solution. May we post replies if we have questions?
3 steps to success? This seems great! Could you provide a preview of the file? As a university employee, I have to be careful about downloading files from the internet.
I 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.

@_yoAshley_ 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. 

Good point! It's safe to say @Quadruple_Pawn had the best answer to my question, but @Riny_van_Eekelen your addition is the Best Upgrade.


You are welcome to post replies if you have questions. I’m glad my suggestion helped.

@Quadruple_Pawn I have been playing with this today and I am struggling. I keep receiving the below error. Thoughts?




Most probably you shall use commas instead of semicolons and like. Usual issue if don't have Excel file with formula.

Hi. We have been trying so hard to utilize your formula you posted so we can do multiple columns at a time but when we add in the plus signs we get a calc error. Below is the list of column formulas, any suggestions on how to combine them?
=FILTER(Students!A:D,Students!F:F="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!G:G="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!H:H="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!I:I="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!J:J="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!K:K="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!L:L="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!M:M="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!N:N="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!O:O="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!P:P="2022 SP1 MBA 504")
=FILTER(Students!A:D,Students!Q:Q="2022 SP1 MBA 504")


Use exact ranges, better tables or at least dynamic ranges

=FILTER(Students!A1:D10000,Students!F1:F10000="2022 SP1 MBA 504")


=FILTER(Students!A:D,(Students!C:C="2022 SP1 MBA 504")+

(Students!D:D="2022 SP1 MBA 504")+

(Students!E:E="2022 SP1 MBA 504")+

(Students!F:F="2022 SP1 MBA 504")+

(Students!G:G="2022 SP1 MBA 504")+

(Students!H:H="2022 SP1 MBA 504")+

(Students!I:I="2022 SP1 MBA 504")+

(Students!J:J="2022 SP1 MBA 504")+

(Students!K:K="2022 SP1 MBA 504")+

(Students!L:L="2022 SP1 MBA 504")+

(Students!M:M="2022 SP1 MBA 504")+

(Students!N:N="2022 SP1 MBA 504")+

(Students!O:O="2022 SP1 MBA 504")+

(Students!P:P="2022 SP1 MBA 504")+

(Students!Q:Q="2022 SP1 MBA 504"))


Above formula works fine in my spreadsheet. If you only want the IDs to be returned, replace " Students!A:D " by " Students!A:A " .


=FILTER(Students!A:D,Students!G:G="2022 SP1 MBA 504")

This formula for example returns a calc error because course name 2022 SP1 MBA 504 doesn't exist in sheet Students in Column G (Course 5).