Hi and welcome to the forum

Not sure if this will help at all, but if you have a 2-column list (Guest_Id and Booking_ID) you could sort on Guest and do it that way?

What are you planning on doing with the info once you have it?