If you do NOT have O365, I suggest a VBA or Power Query solution.
However, if you have Excel O365, you can try the following:
- Create a Table from your data (my Table name is
Table5
; adjust the formulas to match your table name.
- Doing so will automatically place Headers in the blank columns with names like
ColumnN
where N
is a number
Given that my results start in A22 (see below)
Formulas:
A sorted list of the unique dates from your original table:
A23: =SORT(UNIQUE(FILTERXML("<t><s>" & TEXTJOIN("</s><s>",TRUE,INDEX(Table5,SEQUENCE(ROWS(Table5)),SEQUENCE(,COLUMNS(Table5)/2,1,2))) & "</s></t>","//s")))
A list of the Corporations:
B22: =FILTER(Table5[#Headers],ISERR(FIND("Column",Table5[#Headers])))
Return the matching values
B23: =LET(x,INDEX(Table5,SEQUENCE(ROWS(Table5)),SEQUENCE(,2,MATCH(B$22,Table5[#Headers],0)-1)),y,XLOOKUP($A23,INDEX(x,0,1),INDEX(x,0,2),""),y)
Select B23
and fill down and across to fill the results table.
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/SL4qe.png)
Explanation of Unique Dates formula:
INDEX(Table5,SEQUENCE(ROWS(Table5)),SEQUENCE(,COLUMNS(Table5)/2,1,2))
will return a table that contains only the odd numbered columns (which are the date columns)
TEXTJOIN("</s><s>",TRUE,the_odd_column_table)
joins all of the entries in those date columns into a single string with the specified delimiter
FILTERXML("<t><s>" & the_joined_string & "</s></t>","//s")))
creates a XML and then returns an array of the nodes (which will be the dates from the original table).
SORT(UNIQUE(the_dates_array))
does the obvious.