It is recommended to first read and understand the entrance Conditional Formatting - formulas for selecting cells
For this example we will use a normal list of days. In my case the list is in the range A1: A15.
1. Highlighting a specific day of the week
For example, let's highlight all Mondays. To do that, we will insert the following formula:
=WEEKDAY(A1,2)=1
To achieve this highlight effect we are using the function WEEKDAY(). If you are not familiar with how this function works click in this link WEEKDAY().
And the result is:
If a different day needs to be highlighted the formula would be:
=WEEKDAY(A1,2)=1 for Mondays
=WEEKDAY(A1,2)=2 for Tuesdays
.....
=WEEKDAY(A1,2)=7 for Sundays
2. Highlighting weekends
=WEEKDAY(A1,2)>5
3. Highlight two or more non-consecutive days
If what we wanted to highlight were non-consecutive days, for example, all Tuesdays and all Fridays, then the following formula would do the trick:
=OR(WEEKDAY(A1,2)=2,WEEKDAY(A1,2)=5)
It uses the formula OR() with 2 conditions, one WEEKDAY(A1,2)=2 for Tuesdays and WEEKDAY(A1,2)=5 for Fridays.
Showing a result of:
Download an example file
To download an example file with all the examples that we are covering here click on the following link:
No comments:
Post a Comment