Change the background color of a cell if it is a weekend

exceltadpole

Board Regular
Joined
Jan 14, 2004
Messages
108
Column D has dates for one month in the format "mmm dd, yyyy - ddd" in cells D1, D2 ... D30:
Sept 01, 2007 - Sat
Sept 02, 2007 - Sun
Sept 03, 2007 - Mon
Sept 04, 2007 - Tue
.....
Sept 30, 2007 - Sun


I want to change the background color of the cells E1:G1 if D1 is a weekend.
In other words, if D2 has a Sat or a Sun then E2:G2 should have a yellow background.
Keeping in mind that cells in the range E2:G2 already contain data.

How can I do this?
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Select the range E1:G30 with E1 active cell

Format > Conditional formatting > formula is

=(WEEKDAY($D1,2)>5)*($D1<>"")

select desired pattern, OK
 

bobinnc

Active Member
Joined
Nov 4, 2006
Messages
281
Try Conditional Formatting (under the Format Menu). Select E1 through G1. Then do menu Conditional Formatting. Change the drop down from "Cell Value Is" to "Formula Is" and use the following format:
Code:
=WEEKDAY($D1,2)>5
Then change the pattern to show a Yellow color.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,656
Messages
5,597,390
Members
414,141
Latest member
Joey_T92

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
Top