如何自定义 header 值的顺序,当 Google 工作表中答案为是时加入
How to customize order of header values that are joined when answer is yes in Google Sheets
如何修改此 Google Spreadsheet which I found as an answer to another 中的等式,以便它允许用户自定义替换值的顺序?
目标
将给定行(即 A2:D4)范围内的“是”答案替换为 header 值,并按所需顺序在 E4 中用逗号分隔。
初步接近
初步方法在传播sheet(更多下图)中使用“辅助”单元格,但我希望能帮助您组合两个独立的公式。
指定顺序
header 以所需顺序标有数字。原始公式将查找“是”并将其替换为范围内任何问题的 header 值,并输出为索引
第二个公式将按字母顺序对值进行拆分和排序,然后对数字进行 REGEXREPLACE。
非常感谢任何帮助组合这两个公式的人!
第 1 组:
=index(substitute(substitute(trim(transpose(query(transpose(if(B2:E<>"yes",,substitute(B1:E1," ","❄️"))),,9^9)))," ",", "),"❄️"," "))
和
=TRIM(REGEXREPLACE(JOIN(",",SORT(TRANSPOSE(SPLIT(E2,",")))),"\b\d_",""))
备选方案 #2
INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE( IF(B2:E="yes", B1:E1&",", )),,9^9))), ",$", ))
和
=TRIM(REGEXREPLACE(JOIN(",",SORT(TRANSPOSE(SPLIT(E2,",")))),"\b\d_",""))
提前感谢您的帮助!
分享的googlesheet是here
使用:
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(TRANSPOSE(SORT(TRANSPOSE(A2:D), FLATTEN(A1:D1), 1))="yes",
REGEXREPLACE(TRANSPOSE(SORT(FLATTEN(A1:D1))), "(^\d+_)", )&",", )),,9^9))), ",$", ))
如何修改此 Google Spreadsheet which I found as an answer to another
目标 将给定行(即 A2:D4)范围内的“是”答案替换为 header 值,并按所需顺序在 E4 中用逗号分隔。
初步接近 初步方法在传播sheet(更多下图)中使用“辅助”单元格,但我希望能帮助您组合两个独立的公式。
指定顺序 header 以所需顺序标有数字。原始公式将查找“是”并将其替换为范围内任何问题的 header 值,并输出为索引
第二个公式将按字母顺序对值进行拆分和排序,然后对数字进行 REGEXREPLACE。
非常感谢任何帮助组合这两个公式的人!
第 1 组:
=index(substitute(substitute(trim(transpose(query(transpose(if(B2:E<>"yes",,substitute(B1:E1," ","❄️"))),,9^9)))," ",", "),"❄️"," "))
和
=TRIM(REGEXREPLACE(JOIN(",",SORT(TRANSPOSE(SPLIT(E2,",")))),"\b\d_",""))
备选方案 #2
INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE( IF(B2:E="yes", B1:E1&",", )),,9^9))), ",$", ))
和
=TRIM(REGEXREPLACE(JOIN(",",SORT(TRANSPOSE(SPLIT(E2,",")))),"\b\d_",""))
提前感谢您的帮助!
分享的googlesheet是here
使用:
=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(
IF(TRANSPOSE(SORT(TRANSPOSE(A2:D), FLATTEN(A1:D1), 1))="yes",
REGEXREPLACE(TRANSPOSE(SORT(FLATTEN(A1:D1))), "(^\d+_)", )&",", )),,9^9))), ",$", ))