My example will only work if you have Excel 365
If you do not then please ignore this response.
See attached workbook.
It uses 2 formulas. The first is a UNIQUE() formula on the ID numbers.
The second formula is a combination of TEXTSPLIT() TEXTJOIN() and FILTER() based on the ID# formula.
Bookmarks