I need a formula to say if the time in cell A2 is before 6 p.m. Then the time in cell B2 should be before 1 p.m. If not highlight it red. Does that make sense?

The formula I was using prior to calculate times was this:

=IF(G2>M2,M2+1-G2,M2-G2)

Where
G2 was my Requested Time
M2 was my Received Time

But now I want to add the condition of if G2 is before 6 p.m. then M2 should be before 1 p.m.

How can I accomplish this?