L P
L P

Reputation: 3

Excel IF formula between two times in day

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

Upvotes: 0

Views: 297

Answers (2)

Scott Craner
Scott Craner

Reputation: 152450

Use AND():

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

Upvotes: 1

Mayukh Bhattacharya
Mayukh Bhattacharya

Reputation: 27233

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

Upvotes: 1

Related Questions