Function for displaying a value checked against another set of values

Sign up list (rows hidden for clarity)
So I’d like to make a sign up sheet that is typically first come first serve, but in order to allow more people to get a turn for a recurring event, I want to compare the current sign up list to the previous list and anyone who got to go last time would get bumped down to allow someone else to come up in the list.

So for the amount of time we will have for the event I am figuring 10 people will get to go, but I would allow more to sign up.

In the attached, column B is set to data validate against a list of names of available participants. They would go and insert themselves into whichever slot 1-10 that they’d like, and anyone else that is interested in participating can sign up for slots 11-20.

Column D would be the order that people get to go. And I’d like a case where D27 = B27, but checks to see if the name entered in B27 occurs in D3:D12. If it does occur in that set, then it would look for the next available name in B37:B46. Then of course D28 would do the same and look for the next available name in the same set.