Compare hours in Excel

Solved
vérité -  
zinoure Posted messages 14 Status Member -
Hello,
thank you for helping me.
I have two time slots from 6:00 AM to 9:00 PM and from 9:00 PM to 6:00 AM.
When I enter a start time in cell A1 and an end time in B1, if both times I entered fall within the interval of 9:00 PM to 6:00 AM, then cell C1 displays a value of 1; otherwise, it displays 2.
the

Configuration: Windows 7 / Firefox 35.0

2 answers

  1. via55 Posted messages 14393 Registration date   Status Member Last intervention   2 759
     
    Good evening

    Use a formula of this style:

    =IF(AND(A1>=6/24,A1<21/24,B1>6/24,B1<=21/24),2,1)

    Best regards

    --
    "Imagination is more important than knowledge." A. Einstein
    0