Help with Conditional Formatting Dates

deynSTW

New Member
Joined
Mar 30, 2017
Messages
12
Hi All,

Could someone help with with the condtional formatting of dates and differnet rules please.

If A1 has a date of :

Monday - Friday 07:00 - 21:00 and Saturday - Sunday 07:00 - 16:30 = B1 to be coloured AMBER
Monday - Friday 21:01 - 06:59 and Saturday - Sunday 16:31 - 06:59 = B1 to be coloured GREEN

If B1 has a date of less than today = B1 to be coloured RED

Any help would be much appreciated thanks.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
the below works for Amber, you can tweak the times for Green:
PHP:
 =OR(AND(WEEKDAY(A1,2)<=5,TIME(HOUR(A1),MINUTE(A1),0)>=TIME(7,0,0),TIME(HOUR(A1),MINUTE(A1),0)<=TIME(21,0,0)),AND(WEEKDAY(A1,2)>=6,TIME(HOUR(A1),MINUTE(A1),0)>=TIME(7,0,0),TIME(HOUR(A1),MINUTE(A1),0)<=TIME(16,30,0)))
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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