0

I have a Sheet with a database of names, the group they are in, and the color they have earned (that's the short explanation). It looks like this:

Database

I want to create a tab where the colors for each group are placed in one cell with a comma in between, like this:

Output

I can get this output by using this formula [in B2 on the output sheet]:

=IF(A2:A<>"",JOIN(", ",FILTER(Sheet1!C2:C,Sheet1!B2:B =A2)),"")

I would like to take this formula above and turn it into an Array so that it will automatically apply down the whole column as groups are added or taken off the input database. I tried using this formula in B1, but the condition in the filter function, meant to apply to each row, is just outputting everything.

={"Colors"; ARRAYFORMULA(IF(A2:A<>"",JOIN(", ",FILTER(Sheet1!C2:C,Sheet1!B2:B =A2:A)),""))} 

Suggestions to make the Array Formula output like shown in the second picture? TIA

EDIT: In the actual database, there is several columns of data for each person (not just color) and I want to be able to return the array format for each. So, on the output tab there might be an array of colors for each group in Col B, but then an array of ages in C, heights in D, etc. Here is a link to my example

1
  • share a copy / sample of your sheet with an example of the desired output Commented Jun 14, 2022 at 23:43

1 Answer 1

1

use:

=ARRAYFORMULA(REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({B1:B&"×", C1:C&",", ROW(B1:B)}, 
 "select max(Col2) where Col1 <> '×' group by Col3 pivot Col1"),,9^9)), "×")), ",$", ))

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

This works great for the sample, but I just updated my OP to clarify. there are multiple columns of data that I want to put into array format for each group.
@TeedFerguson like this: i.sstatic.net/asGTM.png
Not quite. I'll add a link to my sample spreadsheet in the OP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.