I hope you do enjoy this free blog. I only ask one thing from you in return, click in one of the ads

Friday, 20 February 2015

Conditional Formatting - Formula to highlight any day(s) of the week

Today we are looking at another example of using formulas in conditional formatting.

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


If what we wanted to highlight were the weekends, then the following formula would do the trick:

=WEEKDAY(A1,2)>5




 The result would be:




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:



Subscribe and get all entries via email


You can do it by providing your email into "Join the newsletter" box in the right sidebar.


Or follow me via Social Media

FacebookTwitter and Google+

No comments:

Post a Comment