Hi Kevin,
If you want to color the hours when the start time can be greater then the stop time (from 10 pm to 5 am) you can use the following formula:
=IF($B5<$C5,IF(J$1>$B5,IF(J$1<$C5,TRUE,FALSE),FALSE),IF(J$1<$C5,TRUE,IF(J$1>$B5,TRUE,FALSE)))
This will check to see if column B (the start time) is less then the value in column C (the end time). If so, we are going to test to see if the value in column B is greater then the value in row 1. In that case we also have to check if the value in column C is less then the value in row 1. If both cases are true, we return TRUE (apply conditional formatting). If either one is not true we return FALSE (don't apply conditional formatting).
If the value in column B (the start time) is greater then the value in column C (the end time), the test is to see if the value in row 1 is less then the value in column C. In that case, return TRUE. If the value in column 1 is greater then the value in column C, check to see if the value of column 1 is also greater then the value in column B. If this is the case, return TRUE. If not, return FALSE.
Kindest regards,
Stijn Vanwinckel
Hi Stijn
Fantastic it works a treat one further question if you can assist.
Is it possible to include a second set of criteria ie the break time start and finish which would colour the respective cells a different colour.
I know its a lot to ask but its been bugging me for quite some time
many thanks Kevin
Hi Kevin,
You can't put the break times in another color, because you can only have three conditional formatting conditions. So you can't put the break times in other colors. What you can do is put the break times without conditional formatting, so it shows up in the same color as the background. I will mail you the formulas for that later, with an Excel Workbook example.
Kindest regards,
Stijn Vanwinckel