Home > Software engineering >  Excel IF formula between two times in day
Excel IF formula between two times in day

Time:03-07

I would like to have a formula that will tell me if the time in a cell is between a range of time by returning a Yes or No value.

I used a code for one time, but am having a hard time expanding the formula for two times.

=IF(G2="","",IF(G2<(--"12:00 PM"),"Yes","No"))

The above code works

=IF(H2="","",IF(H2<(--"12:00 PM"),H2<(--"3:00PM")),"Yes","No"))

Any help is appreciated

CodePudding user response:

Use AND():

=IF(H2="","",IF(AND(H2<(--"12:00 PM"),H2>(--"3:00PM")),"Yes","No"))

CodePudding user response:

You may try this way as well,

=IF(H2="","",IF(AND(H2<0.5,H2>0.625),"Yes","No"))

Where 0.5=12:00 PM
Where 0.625=3:00 PM
  • Related