How to Change the Color of Weekends with Conditional Formatting in 3 Easy Steps
- Create a test on the value of the day
First, we must build a test with the WORKDAY function
- Create a custom conditional formatting rule
Use the previous test as a custom rule
- Change the color of Weekends
When the test is TRUE, your test will apply a specific color
To explain how to change the color of weekends, let's start with this calendar. Each day is the result of a formula with the DATE function.
Step 1: Create the test for the weekend
When you create your custom rules for conditional formatting, the most important is to create your logical test. Here, the logical test is quite simple. The WEEKDAY function returns the day value in a week from a date(1 is Sunday, 2 is Monday, ...)
=WEEKDAY(B1) => 1
But you can also add an argument to this function to start your week the Monday and then Saturday = 6 and Sunday = 7
=WEEKDAY(B1, 2) => 7
But what we want, it's a logical test to find if a day is a weekend or not. To convert the previous formula into a logical test, we simply have to write this
Step 2: Use your test as a conditional formatting rule
- Open the menu Conditional Formatting > New Rule
- In the next dialog box, select the menu Use a formula to determine which cell to format (1)
Step 3: Copy the formula of the test
In the text box (2), copy the logical test created in step 1.
Note: In this case, you must lock only the reference of the rows in order to stay always on the date's row (row 1).
Step 4: Customize the color when the test is TRUE
The last step is to customize the format of your cell.
- Click on the Format button (3) to create your custom color when the test will be TRUE.
- Select the tab Fill
- Choose one color in the list
- Validate by clicking on OK
Step 5: Apply the rule to a range of cells
At this step, the conditional formatting is for only one cell. To extend the range of cells for this rule we must open Conditional Formatting> Manage Rules
- Then, select This Worksheet to see the worksheet rules instead of the default selection.
- Then in the Applies to section, change the range corresponding to your initial selection when creating your rules to extend it to the whole column.
- And now, all the dates equal to a weekend have a different color 😎😍😃
To understand why we have used only one $ in the formula, you can read this article to color an entire row with conditional formatting.