I'm running a QUERY
with a SUM
and GROUP BY
, but I'd like to aggregate multiple distinct values from the rows into a single row and column. I'm looking to concatenate all those values together.
Current Table:
Person | Widget | Count |
---|---|---|
Bill | Red | 12 |
Bill | Blue | 9 |
Sarah | Yellow | 4 |
Bill | Yellow | 1 |
Sarah | Orange | 10 |
Expected Table:
Person | Widget | Count |
---|---|---|
Bill | Red, Blue, Yellow | 22 |
Sarah | Yellow, Orange | 14 |
You can use the filter and join functions to help:
To get a unique list of names:
=UNIQUE(A3:A)
To join the widgets:
=join(",",filter(B:B,A:A=E3))
To sum the values:
=sum(filter(C:C,A:A=E3))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With