# Conditional Format a Work Schedule

I am needing to conditional format a work schedule. I would like to color different times to indicate different shifts. Basically I want to tell excel "If the start time = 7:00 AND the end time = 17:00 THEN color both cells a certain color".

Is there an easy (amateur) way to do this?
TimeSheet.xlsx
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Group Finance ManagerCommented:
0
Finance AnalystCommented:
With your example only one of those time slots matches the 7:00 to 17:00 criteria.

What happens when the time slots don't match that specific time range?

Should it be start at/after 7:00 and finish at/before 17:00 = Day Shift?

Oscar S does 21:00 to 9:00 - presume this is a night shift.

At what point does a Night Shift start? eg Gabriel F does 15:00 to 0:00
0
AnalystAuthor Commented:
Right, so I am sure I can change up the formula once I have a baseline formula Rob.

As a rule of thumb though, I would say night shift is from 0:00 to 8:00, C shift is from 15:00 to 0:00, Day shift is from 8:00 to 16:00.
0
Excel & VBA ExpertCommented:
To highlight the cells if the Start Time = 7:00 and End Time =17:00, select the range B7:AC34 and use the below formula to make a new rule for conditional formatting and set the format as per your choice.

``````=OR(AND(B\$6="Start",B7=TIMEVALUE("07:00:00"),C7=TIMEVALUE("17:00:00")),AND(B\$6="End",A\$6="Start",A7=TIMEVALUE("07:00:00"),B7=TIMEVALUE("17:00:00")))
``````

TimeSheet.xlsx
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

AnalystAuthor Commented:
Awesome you have helped greatly!! I am still having an issue with midnight however. any idea why the timeframe from 15:00 to 0:00 isn't working?
0
Excel & VBA ExpertCommented:
For that time period, the formula should be as given below.
But the cells where you see the time values as 00:00:00 (e.g. in E14), if you click on any of those cells and look at the formula bar, you will find a date and time value 01/01/1900 00:00:00 which in fact is equivalent to 1 and you can confirm it by changing the format of those cells to General. 1 here is the first data in the calendar recognized by excel as excel treats dates as real numbers.
So make the following formula to work properly, all you need is, delete the date part from those cells and the formula will fine.

``````=OR(AND(B\$6="Start",B7=TIMEVALUE("15:00:00"),C7=TIMEVALUE("00:00:00")),AND(B\$6="End",A\$6="Start",A7=TIMEVALUE("15:00:00"),B7=TIMEVALUE("00:00:00")))
``````
0
AnalystAuthor Commented:
I saw the date was automatically inserted but I didn't even think about just deleting it.. duh! Thanks a bunch!
0
Excel & VBA ExpertCommented:
You're welcome! Glad I could help.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.