Forum Discussion
rrachlow1990
Nov 05, 2023Copper Contributor
Macro Help
Hello all - I've got a spreadsheet with about 3500 rows that I'm trying to clean up to be able to use in Pivot Tables. It's got merged info in columns B & C that are causing problems. Column B ...
- Nov 08, 2023
This formula will 'unpivot' the raw data. I began by unmerging all cells.
=LET( header, TAKE(matrix, 1), FillDown, LAMBDA(a, v, IF(v = "", a, v)), Faculty, INDEX(matrix, , 3), Course, INDEX(matrix, , 6), uFaculty, SORT(UNIQUE(TOCOL(Faculty, 1))), Semester, SCAN("", TAKE(matrix, , 1), FillDown), Department, SCAN("", INDEX(matrix, , 2), FillDown), FacultyNames, SCAN("", Faculty, FillDown), CrossListed, SCAN("", INDEX(matrix, , 4), FillDown), CourseDetails, TAKE(matrix, , -12), Record, HSTACK(Semester, Department, FacultyNames, CrossListed, CourseDetails), UnPivot, LAMBDA(a, v, LET( filtered, FILTER(Record, (FacultyNames = v) * (Course <> "Total"), ""), IFNA(VSTACK(a, filtered), "") ) ), REDUCE(header, uFaculty, UnPivot) )
rrachlow1990
Nov 08, 2023Copper Contributor
Patrick2788 - you are brilliant! Thank you! It going to take me a while to work through the formula to understand it, but it's awesome!
I don't really understand Power Queries, but I would like to, so you've given me lots to work on...thanks again - great community!!!
Patrick2788
Nov 08, 2023Silver Contributor
Glad to help. You're welcome!