How to combine rows with same ID in Google Sheets?

强颜欢笑 提交于 2020-01-30 08:54:04

问题


I'm trying to merge rows with same IDs in Google Sheets

From:

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

To:

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

Is there an automatic way to do it in Google Sheets itself, using its native functions?


回答1:


=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))



来源:https://stackoverflow.com/questions/56469837/how-to-combine-rows-with-same-id-in-google-sheets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!