Forum Discussion

Zdenek_Moravec's avatar
Zdenek_Moravec
Iron Contributor
Jan 21, 2024
Solved

How to wrap table, not vector (WRAPCOLS for tables)

Dear colleagues

I have a long table of 5 columns and maybe 200 rows.

The task is to wrap the table after a specified number of rows to see the table in landscape on a new sheet.

I was thinking about WRAPCOLS, but it works only for vector (one column). Is there a way to wrap whole table using M365 functions? If not, the next option can be Power Query.

See example attached.

Thank You very much for any hint.

Zdenek Moravec

Cesky Krumlov, Czechia

14 Replies

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    Hi Zdenek_Moravec 

     

    Would this work for you (Biology; 4 rws)?:

    =LET(
      rws,    4,
      data,   FILTER(T_Data[[Question]:[Answer4]], T_Data[Subject] = "biology"),
      k,      SEQUENCE( ROUNDUP( ROWS(data) / rws, 0)-1 ),
      Stack,  LAMBDA(seed,n, HSTACK(seed, TAKE( DROP(data, rws*n), rws) ) ),
      IFNA( REDUCE(TAKE(data,rws), k, Stack), "")
    )