【问题标题】:Split multiple question answer from Google Forms by phrases in Google Sheets按 Google 表格中的短语拆分来自 Google 表单的多个问题答案
【发布时间】:2021-08-16 10:43:22
【问题描述】:

我在用多个答案问题填写 Google 表单后创建了一个 Google 表格

Timestamp Event First name last name
1/10/2021 18:11:01 Event A Jane Jones
1/10/2021 18:12:35 Event A, Event B Joe Jones
1/10/2021 18:14:26 Event B, Event C Jennifer Adams
1/10/2021 18:15:35 Event A, Event C John Smit

问题是事件 A 和事件 B 本身可能有逗号,例如“步行、骑行”或“游泳、跳跃”。在 Google 表格中,它看起来像“步行、骑行、游泳、跳跃”

我想通过“步行、骑行”和“游泳、跳跃”这两个短语来拆分这个多个答案列,以获得类似的结果。我该怎么做?

Timestamp Event First name last name
1/10/2021 18:11:01 Event A Jane Jones
1/10/2021 18:12:35 Event A Joe Jones
1/10/2021 18:12:35 Event B Joe Jones
1/10/2021 18:14:26 Event B Jennifer Adams
1/10/2021 18:14:26 Event C Jennifer Adams
1/10/2021 18:15:35 Event A John Smit
1/10/2021 18:15:35 Event C John Smit

【问题讨论】:

    标签: google-sheets google-sheets-formula google-forms


    【解决方案1】:

    试试:

    =arrayformula({A1:D1;
    query(
    array_constrain(
    {
    flatten(split(rept(","&A2:A,len(regexreplace(B2:B,"[^\,]",))+1),",")),
    trim(flatten(split(B2:B,","))),
    flatten(split(rept(","&C2:C,len(regexreplace(B2:B,"[^\,]",))+1),",")),
    flatten(split(rept(","&D2:D,len(regexreplace(B2:B,"[^\,]",))+1),","))
    },
    max(if(B2:B<>"",len(regexreplace(B2:B,"[^\,]",""))+1,))*counta(B2:B),4),
    "where Col3 is not null",0)})
    

    【讨论】:

      【解决方案2】:

      使用:

      ={A1:D1; INDEX(QUERY(TRIM(SPLIT(FLATTEN(IF(IFERROR(SPLIT(B2:B, ","))="",, 
       TO_TEXT(A2:A)&"×"&SPLIT(B2:B, ",")&"×"&C2:C&"×"&D2:D)), "×")),
       "where Col2 is not null"))}
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多