sample rota.xlsx

I am trying to set up a rota based on 24hr shifts.

When I type in a start time and end time I want the relevant time of day cell to be highlighted.

I know the first part works on its own but the later time throws the formula out.

Please help!