Query one table and output data into multiple columns

后端 未结 1 1968
暖寄归人
暖寄归人 2021-01-24 09:36

Simply put I am trying to take a single column query result and output it into a 5 wide by × long table. This is how the main table is organized.

On separate t

相关标签:
1条回答
  • 2021-01-24 10:10

    if you put your query output in some auxiliary column, you can use this formula and drag down:

    =ARRAY_CONSTRAIN(TRANSPOSE(INDIRECT("A"&6+(ROW()-ROW($A$2))*5&":A")), 1, 5)
    


    for 6 columns:

    =ARRAY_CONSTRAIN(TRANSPOSE(INDIRECT("A"&7+(ROW()-ROW($A$2))*6&":A")), 1, 6)
    

    for 3 columns:

    =ARRAY_CONSTRAIN(TRANSPOSE(INDIRECT("A"&4+(ROW()-ROW($A$2))*3&":A")), 1, 3)
    

    for 5 columns but starting on 10th row:

    =ARRAY_CONSTRAIN(TRANSPOSE(INDIRECT("A"&6+(ROW()-ROW($A$2)-9)*5&":A")), 1, 5)
    

    etc.

    0 讨论(0)
提交回复
热议问题