Please reference my sample spreadsheet here: https://docs.google.com/spreadsheets/d/1OsD43iqox_RfatUf-OThryGJ-U9XOo_6e_JzieJIH3o/edit?usp=sharing
General Description of Problem:
I start with a multicolumn spreadsheet and insert three columns to the left. I want to drop in formulas to the new columns to get the output as shown in the example. The number of Scenes per Chapter is variable. The number of Chapters per Act is variable. So these groupings will have to be constructed from the input data. There is a column with a data type (Scene: f_xxx, Chapter: st_chapter, Act: st_act) and the Name column contains consistent names for Chapters and Acts, though Scenes can have any name.
1.) In the spreadsheet, the three input columns (D, E, F) represent what I have to work with.
2.) Columns (A, B, C) represent what I want as output.
Notes:
A.) I cannot change the format of the input columns. They are produced by a program that I don't control.
B.) Irrelevant to the solution, but just for info, I add new columns to the left because I have a function that copies the original data (columns) to the right of the new/computed columns.
C.) Obviously Columns 'A' and 'F' contain the same data. It is irrelevant whether column 'A' actually gets created.