Thank you!
It doesn't seem to work very well but i will look into it further.
What a strange response. Why would you thank me twice for something you think doesn't work?
It works fine based on the description you gave me of what you wanted. I don't know what you mean by "it doesn't seem to work very well". In what way? Of course, I don't know what job you actually ran or what data you actually used. The job I showed gave the results you asked for with the data you showed - I always test the solutions I give out. If it didn't work very well, then I would guess you didn't describe what you wanted very well (GIGO).
Meanwhile i managed to achieve the desired output using splice and making a set of comparisons.
The job I showed does use SPLICE and does make a set of comparisons. I don't know what you did differently since you didn't bother to show your job.