如何用“,”加入该公式的阵列结果?

时间:2019-07-25 02:21:59

标签: join google-sheets google-sheets-formula array-formulas google-sheets-query

我尝试在我能想到的所有位置向此公式添加JOIN,但似乎都不正确。

=ARRAYFORMULA(IFERROR(VLOOKUP(D2:D&E2:E, 
 TRIM(IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 {INDEX(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦"&tasksAssociations!G2:G, )), 1, 1), "♦")), 
 "select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),,1), IF(
 ISNUMBER(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦"&tasksAssociations!G2:G, )), 1, 1), "♦")), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0)),
 QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦♥"&tasksAssociations!G2:G, )), 1, 1), "♦")),
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0", 0), )})
 ,,999^99))), "♥"))), {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, 0)))

结果是多列/行。我想保留行,但在列值JOIN上加上“ ,”。

my sheet

1 个答案:

答案 0 :(得分:1)

也许像这样:

=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(SUBSTITUTE(IFERROR(VLOOKUP(D2:D&E2:E, 
 TRIM(IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 {INDEX(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦"&tasksAssociations!G2:G, )), 1, 1), "♦")), 
 "select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),,1), IF(
 ISNUMBER(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦"&tasksAssociations!G2:G, )), 1, 1), "♦")), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0)),
 QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(tasksAssociations!C2:C&tasksAssociations!D2:D))*(LEN(tasksAssociations!G2:G)), 
 tasksAssociations!C2:C&tasksAssociations!D2:D&"♦♥"&tasksAssociations!G2:G, )), 1, 1), "♦")),
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0", 0), )})
 ,,999^99))), "♥"))), {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, 0)), " ", "♫")),,999^99))), " ", ", "), "♫", " "))

0