I need to do some data quality check on a table which looks like this:

These are vehicles entering a compound, and are sorted on their timestamps. (Timestamp column not show here)
Ideally a vehicle enters a compound and then exits it. However there are multiple cases as you can see, where a car enters multiple times.
I need to identify these cases.
a vehicle_instance_id should have a Compound gate-in, followed by a row with Compound-gate-out.
It should not have multiple Compound Gate-in rows after one another.
How can I use the Multi-Row Formula, to identify these cases?
Wtih kind regards,
Lazzanova