Skip to content

Instantly share code, notes, and snippets.

@iingLK
iingLK / 01
Last active March 25, 2023 15:21
XLS365 LAMBDA
ft.SORT_COLS = LAMBDA(table,
LET(
header, CHOOSEROWS(table, 1),
values, DROP(table, 1),
ncols, COLUMNS(table),
headstack, VSTACK(header, SEQUENCE(1, ncols)),
headsorted, SORT(headstack, 1, 1, TRUE),
newindex, CHOOSEROWS(headsorted, 2),
sortedvalues, CHOOSECOLS(values, newindex),
sortedheader, CHOOSEROWS(headsorted, 1),