You can do that with this:

=MIN((FLOOR(B1,1/24/4)-FLOOR(A1,1/24/4)+(A1>B1))*24,2)

Changes in red.

Hope this helps.

Pete