Google-sheets – Aggregate data to show text in one cell

google sheetsgoogle-sheets-query

I need to put together multiple entries into one where the results is text and has to be in one cell.

From this

table 1

to this

table 2

Best Answer

There is an excellent precedent on StackOverflow for this question - though I can't locate it just as the moment. This solution is based on How to do a "group concat" in an ARRAYFORMULA? in the Google support form.

Let's assume that your raw data is in Columns A and B, and the output will be in Columns C and D.

Insert this formula in Cell C1.
=Arrayformula(unique({A1:A, substitute(Trim(transpose(query(if(transpose(A1:A)=A1:A,B1:B&Char(10),),,9^99))),char(10),",")}))


BEFORE - raw data

Before


AFTER - additional data

After