Hi
On Sheet1 I have the following pieces of data:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date[/TD]
[TD]Number[/TD]
[TD]Colour[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]13/09/2019[/TD]
[TD]123[/TD]
[TD]blue,green[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]13/09/2019[/TD]
[TD]456[/TD]
[TD]green,red[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]13/09/2019[/TD]
[TD]789[/TD]
[TD]red[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]14/09/2019[/TD]
[TD]123[/TD]
[TD]green[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]14/09/2019[/TD]
[TD]456[/TD]
[TD]red,blue[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]14/09/2019[/TD]
[TD]789[/TD]
[TD]red,green[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]15/09/2019[/TD]
[TD]123[/TD]
[TD]blue,red[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]15/09/2019[/TD]
[TD]456[/TD]
[TD]yellow,green[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]15/09/2019[/TD]
[TD]789[/TD]
[TD]blue[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]15/09/2019[/TD]
[TD]999[/TD]
[TD]red,blue[/TD]
[/TR]
</tbody>[/TABLE]
On Sheet2 I want to set up a lookup that produces the following results:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Number[/TD]
[TD]Colours[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]123[/TD]
[TD]blue,green,red[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]456[/TD]
[TD]green,red,blue,yellow,green[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]789[/TD]
[TD]red,green,blue[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]999[/TD]
[TD]red,blue[/TD]
[/TR]
</tbody>[/TABLE]
You'll see that it ignores the date and combines the colours into one cell - ignoring duplicate values - and separates each colour with a comma.
At the moment I have some VBA code firing that copies the Numbers, Removes the Duplicates and then Copies the Numbers to Sheet2. It then looks row by row and combines the colours, however, I'm sure there might be a formula that might do the same thing by looking at the Number.
This would remove lines of programming code that perhaps are not necessary and reduce the time it takes for that code to run.
Thanks in advance if anyone can help.
Liam
On Sheet1 I have the following pieces of data:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Date[/TD]
[TD]Number[/TD]
[TD]Colour[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]13/09/2019[/TD]
[TD]123[/TD]
[TD]blue,green[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]13/09/2019[/TD]
[TD]456[/TD]
[TD]green,red[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]13/09/2019[/TD]
[TD]789[/TD]
[TD]red[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]14/09/2019[/TD]
[TD]123[/TD]
[TD]green[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]14/09/2019[/TD]
[TD]456[/TD]
[TD]red,blue[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]14/09/2019[/TD]
[TD]789[/TD]
[TD]red,green[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]15/09/2019[/TD]
[TD]123[/TD]
[TD]blue,red[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]15/09/2019[/TD]
[TD]456[/TD]
[TD]yellow,green[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]15/09/2019[/TD]
[TD]789[/TD]
[TD]blue[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]15/09/2019[/TD]
[TD]999[/TD]
[TD]red,blue[/TD]
[/TR]
</tbody>[/TABLE]
On Sheet2 I want to set up a lookup that produces the following results:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Number[/TD]
[TD]Colours[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]123[/TD]
[TD]blue,green,red[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]456[/TD]
[TD]green,red,blue,yellow,green[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]789[/TD]
[TD]red,green,blue[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]999[/TD]
[TD]red,blue[/TD]
[/TR]
</tbody>[/TABLE]
You'll see that it ignores the date and combines the colours into one cell - ignoring duplicate values - and separates each colour with a comma.
At the moment I have some VBA code firing that copies the Numbers, Removes the Duplicates and then Copies the Numbers to Sheet2. It then looks row by row and combines the colours, however, I'm sure there might be a formula that might do the same thing by looking at the Number.
This would remove lines of programming code that perhaps are not necessary and reduce the time it takes for that code to run.
Thanks in advance if anyone can help.
Liam
Last edited: