请帮助我解决此问题。如果行没有重复的保留值,我需要合并重复的行,然后将第2列中的值连接起来,然后对第3列中的值求和。
给出;
Col1 Col2 Col3
Apple Red 2
Apple Green 5
24829 sk1 2
24829 sd2 8
123 po3 1
Bag black 7
预期输出:
Col1 Col2 Col3
Apple Red,Green 7
24829 sk1,sd2 10
123 po3 1
Bag black 7
答案 0 :(得分:1)
答案 1 :(得分:1)
使用这种单细胞解决方案:
=ARRAYFORMULA({UNIQUE(INDIRECT("A1:A"&COUNTA(A1:A))),
REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(QUERY(""&A1:B,
"select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),
"offset 1", 0)<>"", QUERY(""&A1:B,
"select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0")&",", ))
,, 999^99))), ",$", ), QUERY({""&A1:A, C1:C},
"select sum(Col2) where Col1 is not null group by Col1 label sum(Col2)''", 0)})