Explanation
In this example, the goal is to highlight dates that occur on weekends.
In other words, we want to highlight dates that land on either Saturday or Sunday.
WEEKDAY function
TheWEEKDAY functiontakes a date and returns a number between 1-7 representing the day of week.
By default, WEEKDAY returns 1 for Sunday and 7 for Saturday.
If WEEKDAY returns either 7 or 1, the OR function will return TRUE.
In all other cases, OR will return FALSE.
This is what we need to trigger a conditional formatting rule.
Define the rule
The next step is to define the conditional formatting rule itself.
With the range C5:C16 selected, navigate to Home > Conditional Formatting > New rule.
Then select “Use a formula to determine which cells to format”.
Next, enter the formula above in the formula area and set the desired format.
By default, WEEKDAY returns 1 for Sunday and 7 for Saturday, but this is configurable.
you’re free to use the WEEKDAY function inside other formulas to check the day of week.
OR returns TRUEif any condition is TRUE.
If all conditions are FALSE, the OR function returns FALSE.