Weekends are always important when you create calendar. Let's see how to change the color of these days automatically.
Create your custom rule
In this article, we have seen how to create your custom rule and applied it as conditional formatting.
With the same technique, we are going to see how to create the tests for the week-ends.
Let's start from this calendar.
Build the test
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 function WEEKDAY returns the day value in a week from a date(1 is Sunday, 2 is Monday, ...)
=WEEKDAY(B5) => 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(B5, 2) => 7
Finally, to know if a day is a week-end of not, the test is
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.
Copy your formula
Note: In this case, you must lock the reference of the rows in order to stay on the date (row = 5)
Customise the color when the test is TRUE
Then, customise the format of your condition by clicking on the Format button and you choose a fill color (orange in this example).
- Select the tab Fill
- Choose one color
Apply the rule for a range of cells
At this step, the conditional formatting is for one cell only. So we must extend the range of cells for this rule.
Click OK, then open Conditional Formatting> Manage Rules
- Select This Worksheet to see theworksheet rules instead of thedefault selection.
- Then in the Applies to section, change the range that corresponds to your initial selection when creating your rules to extend it to the whole column.
And now, all the dates equal to a weekends have a different color 😎😍😃
Change the color of the holidays
If you want also to change the color of the holidays, the formula to build the test isn't the same. Explanations in this article.
- Custom rule for conditional formatting
- Display bars in the cells
- Conditional Formatting – Highlight highest values
- What is a conditional formatting
- Split Date and Time
- Weekly calendar 2020 in one formula
- Insert Icons in your cells
- Difference between 2 dates – DATEDIF
- Create a progress bar with icons
- How to Highlight a Birthday Automatically