IF AND Time Range Comparison

barnetod

New Member
Joined
Apr 4, 2013
Messages
2
First post so bare with me.

I am attempting to create a formula which will indicate with a simple YES or NO based on a time value falling between two different times daily.

I have searched and attempted formulas but it seems to just lock into returning NO every time.

If the time is >1700 or <0700 return YES if not return NO.<time(7,0,0),g2 TIME(17,0,0)),?YES?,?NO?)<time(7,0,0),g2="">

=IF(AND(G2<TIME(7,0,0),G2>TIME(17,0,0)),"YES","NO")

Please not for some reason half of my formula is missing.<time(7,0,0),g2><time(7,0,0),g2><time(7,0,0),g2><time(7,0,0),g2>

</time(7,0,0),g2></time(7,0,0),g2>I may be missing an OR statement.

Any help would be appreciated.
After Hours
Time
YES
06:37:00
NO
12:30:00

<tbody>
</tbody>
</time(7,0,0),g2></time(7,0,0),g2></time(7,0,0),g2>
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Your words "If the time is >1700 or <0700 return YES if not return NO." are the opposit of the example you gave at the end. The formula below assumes the time is in cell A1 and it is based on the "words" - if you want it based on the examples, switch the < and > signs:

Code:
=IF(OR(A1 > TIME(17,0,0),A1 < TIME(7,0,0)),"Yes","No")<time(7,0,0)),"yes","no")<time(7,0,0)),"yes","no")< html="">
</time(7,0,0)),"yes","no")<time(7,0,0)),"yes","no")<>
 
Upvote 0
Thank you it worked perfectly. I have been staring at 1800 lines of data and this one thing killed my brain.
 
Upvote 0

Forum statistics

Threads
1,207,387
Messages
6,078,197
Members
446,320
Latest member
vatra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top