List get lowest position z when branches have same x,y

I have a list of positions, sometimes several on the same x, y axis (branches) and if the x, y is identical on the branches, I want to find the lowest and remove the others that are higher. I just can’t find a solution somehow. Is that possible in Grasshopper?

In the photo you can see a borehole and sometimes several layers are identical, but I only need the lowest value.

Thanks for the help.

Geologie.gh (2.0 KB)

Is this what you wanted?
Geologie-b.gh (11.0 KB)

1 Like

Thank you very much, it’s exactly what I was looking for.

Thanks, I’ll take a look at your example too.