Google Query Spreadsheet: reverse transpose

隐身守侯 提交于 2020-01-24 01:53:14

问题


I have this table (as an example)

id  |  a   |   b  |  c 
1   |  23  |   13 |  56 
2   |  67  |  45  |
3   |  43  |      |
4   |  78  |  34  |  45

I want to upload transpose that using the query statement so that I can upload it to my database, the result should look like:

1 | 23
1 | 13
1 | 56
2 | 67
2 | 45
3 | 43
4 | 78
4 | 34
4 | 45

How would I do that?


回答1:


Assuming you have the data in A:D, try:

=ArrayFormula({transpose(split(query(rept(A:A&" ", if(len(B:B), countif(if(not(isblank(B:D)), row(B:B)), row(B:B)),)),,50000)," ")),transpose(split(join(" ",query(transpose(B:D),,50000)), " "))})


来源:https://stackoverflow.com/questions/30354693/google-query-spreadsheet-reverse-transpose

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!