Forum Discussion
BrianJm86
Mar 14, 2024Copper Contributor
Provide column header from selection
Hi, I am looking of a way to convert this vacation selection template from "x" selections to column headers but shift columns if more than one selection is made. Have: ID Store Dept Name De...
- Mar 15, 2024
BrianJm86 One possible dynamic array formula for MS365 would be:
=LET( table, Master!A1:BE10, data, DROP(table, 1, 4), rowId, SEQUENCE(ROWS(data)), recordCount, BYROW(data, LAMBDA(r, COUNTIF(r, "x"))), maxCount, MAX(recordCount), newRows, maxCount-recordCount, cols, SEQUENCE(, maxCount), unpivot, HSTACK(TOCOL(IFS(recordCount>=cols, rowId), 2), TOCOL(IFS(data="x", DROP(TAKE(table, 1),, 4)), 2)), results, WRAPROWS(DROP(SORT(VSTACK(unpivot, EXPAND(TOCOL(IFS(newRows>=cols, rowId), 2),, 2, ""))),, 1), maxCount), HSTACK(TAKE(table,, 4), VSTACK("Week "&cols, results)) )It may seem like a lot but is relatively efficient and should perform quite well with 1,000+ rows of data. Adjust the range reference accordingly to select your entire table range (including the header row).
Results
Please see the attached workbook...
SandeepMarwal
Mar 17, 2024Brass Contributor
It can be done using power query.
refer attached workbook.
copy your complete data in master sheet.
Then in "results" sheet, right click in query output table and choose refresh.