See:
https://dhexcel1.wordpress.com/2017/01/03/creating-a-unique-delimited-string-from-a-delimited-string-excel-formula-method-by-david-hager/
Convert a delimited string like, for example
a,b,c,c,d,a,e,r,h,h,t,o,x,a,b,c (in A1)
to
a,b,c,d,e,r,h,t,o,x