我有多个列取决于此公式。
我有一个实例,一个雇员可以为同一个项目分配多个任务,我使用公式合并行并在相应行中添加导致额外行的值:
我首先执行= Unique(A3:D)
来提取列表,然后:
=IF($A3<>"",join(", ",filter(Sheet1!E$3:E,Sheet1!$A$3:$A=$G3)),"")
如何使它成为ArrayFormula? 我这样尝试过,但结果不正确:
=arrayformula(IF($A2:A<>"",join(", ",filter(Sheet1!E$2:E,Sheet1!$A$2:$A=$G2:G)),""))
这是一个示例电子表格: https://docs.google.com/spreadsheets/d/1cLXNidk6FSZbUeU0CK3XlMPWdpBMbnKMXC5gzTfMvY0/edit?usp=sharing
答案 0 :(得分:1)
一劳永逸:
=ARRAYFORMULA(SPLIT(REGEXREPLACE(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE({
QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, E3:E}, ),
"select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),
"select Col1 offset 1", 0),
IF(QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, E3:E}, ),
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0), "offset 1",0)<>"",
QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, "♦"&E3:E&","}, ),
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0), "limit 0",1), )})
,,999^99))), ", ♦", ", "), ",$", ), "♦"))
仅列 K :
=QUERY(ARRAYFORMULA(SPLIT(REGEXREPLACE(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE({
QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, E3:E}, ),
"select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),
"select Col1 offset 1", 0),
IF(QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, E3:E}, ),
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0), "offset 1",0)<>"",
QUERY(QUERY(IF(A3:A<>"", {A3:A&"♦"&B3:B&"♦"&C3:C&"♦"&D3:D, "♦"&E3:E&","}, ),
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0), "limit 0",1), )})
,,999^99))), ", ♦", ", "), ",$", ), "♦")), "select Col5", 0)