The attached addresses a related problem of how does one colour a randomly generated table.
1. RANDARRAY is used to create the numbered table.
2. SUMIFS is used within a helper range to return the row number corresponding to each element of the array.
3. Conditional formatting and implicit intersection between sheets is used to colour the table.
@deciog
I think this is closer to the problem, as originally specified, in that I have built the lists from the table rather than colouring the table to conform to the list. As I have generated the random distribution of colours using a table of indices, I have then used the helper table to create the lists rather than 'reading' the colours. I have used the LET function to organise the formula. I am not sure whether you have the function yet; otherwise it is a case of reverting to defined names or helper ranges to unpivot the tables.