Forum Discussion

agags333's avatar
agags333
Copper Contributor
Nov 26, 2023
Solved

Lookup across spreadsheet- Random Locations for Headings

Hoping there is a way to lookup the Firstname, Surname, Data1, Data2 and populate the list as shown below- This is a spit out from a database and as such the data can be randomly plotted on the outpu...
  • Patrick2788's avatar
    Nov 28, 2023

    agags333 

     

    Another approach. It's set to handle data like in the example but could be adjusted as needed.

     

    'ReShape
    =LAMBDA(matrix,LET(
        header, {"First Name", "Last Name", "Data1", "Data2", "Data3", "Data4"},
        BinVector, TOCOL(
            N((matrix <> "") * (LEFT(matrix, 4) <> "Data") * (RIGHT(matrix, 4) <> "Name"))
        ),
        seq, SEQUENCE(ROWS(BinVector)),
        r, WRAPROWS(FILTER(seq, BinVector <> 0), 6),
        reshaped, INDEX(TOCOL(matrix), r),
        VSTACK(header, reshaped)
    ))