Nested IF statements with AND or OR

The problem here is that the way you've set up the formula, you're effectively saying

If the first row contains any of the words Off, Vac or Flex, then return 0 [and don't do anything else]

The important thing here is that IF will exit as soon as the first condition it finds to be TRUE is met. So, it's found that F38 contains Flex, and it's stopped there. It is not placing a zero in row 38.

What you want is this:

If either the first or second row is 10AM, then return 1, otherwise return 0

Any other values are irrelevant for this calculation.

I believe the reason you're having an issue with the word Flex is because you're comparing the cell with a decimal representation of the time. This should work:

=IF(OR(A1=TIME(10,0,0),A2=TIME(10,0,0)),1,0)

enter image description here

You can adapt this for your closing column, being sure to use TIME(18,0,0).