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.

Conditional formatting rule to highlight weekends

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.

Conditional formatting rule to highlight weekends

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.

Conditional formatting rule to highlight weekends

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.

Conditional formatting rule to highlight weekends

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.

Conditional formatting rule to highlight weekends

Excel formula: Highlight dates greater than

Excel formula: Highlight dates between

Excel formula: Highlight dates in same month and year

Excel WEEKDAY function

Excel OR function

Article image

Article image

Article image

Article image