如何在Google表格中合并具有相同ID的行?

时间:2019-06-06 01:17:13

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

我正在尝试合并Google表格中具有相同ID的行

发件人:

ID     | Category
Augur  | A1
Augur  | A2
Augur  | A3
Augur1 | A1
Augur1 | A2
Augur1 | A3

收件人:

ID     | Category
Augur  | A1; A2; A3
Augur1 | A1; A2; A3

是否可以使用Google表格的本机功能自动进行此操作?

1 个答案:

答案 0 :(得分:0)

=ARRAYFORMULA(QUERY({INDEX(QUERY(A1:B, 
 "select A,count(A) where A is not null group by A pivot B", 0), , 1),
 REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(ISNUMBER(QUERY(A1:B, 
 "select count(A) where A is not null group by A pivot B", 0)), INDEX(QUERY({A1:A,B1:B&";"},
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 offset 1", 0), 1,), ))
 , , 999^99))), ";$", )}, "offset 1", 0))

0