Split Google Sheets Query results from one row into two

半城伤御伤魂 提交于 2021-02-10 14:30:55

问题


I want to take my QUERY results and move one cell (H [description]) to the following row of each result.

I found this answer, which is very close, but the format of the table is different, so I'm not sure how to apply it to my scenario.

This is the basic idea:

    Category | Sub-Category | Item       | Description
    Fruit    | Citrus       | Orange     | It's orange
    Fruit    | Melon        | Cantaloupe | Round

Into

    Category | Sub-Category | Item  
    Fruit    | Citrus       | Orange     
    It's orange
    Fruit    | Melon        | Cantaloupe 
    Round

回答1:


=ARRAYFORMULA(QUERY(SUBSTITUTE(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(
 QUERY(TRANSPOSE(IF(IFERROR(SPLIT(C1:C, ";"))<>"", "♥"&A1:A&"♦"&B1:B&"♦"&
 IFERROR(SPLIT(C1:C, ";"))&"♥"&D1:D, )),,999^99)),,999^99), "♥")), "♦")), D1, ), 
 "where Col1 is not null", 0))


=ARRAYFORMULA(QUERY(SUBSTITUTE(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(
 QUERY(TRANSPOSE(IF(C1:C<>"", "♥"&A1:A&"♦"&B1:B&"♦"&C1:C&"♥ ♦"&D1:D, ))
 ,,999^99)),,999^99), "♥")), "♦")), D1, ), 
 "where Col2 is not Null", 0))



来源:https://stackoverflow.com/questions/56573111/split-google-sheets-query-results-from-one-row-into-two

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