If a date falls on a weekend

This tutorial shows how to test if a date falls on a weekend and return a value if the test is True or False through the use of an Excel formula, with the IF, OR and WEEKDAY functions

EXCEL FORMULA 1. If a date falls on a weekend

EXCEL

Hard coded formula
If a date falls on a weekend
Cell reference formula
If a date falls on a weekend
=IF(OR(WEEKDAY(B5,1)=1,WEEKDAY(B5,1)=7),"Weekend","Weekday")
=IF(OR(WEEKDAY(B9,1)=1,WEEKDAY(B9,1)=7),$C$5,$C$6)
GENERIC FORMULA

=IF(OR(WEEKDAY(date,1)=1,WEEKDAY(date,1)=7),value_if_true,value_if_false)

ARGUMENTS
date: A date that you want to test if it falls on a weekend.
value_if_true: Value to be returned if the date falls on a weekend.
value_if_false: Value to be returned if the date falls on a weekday.

GENERIC FORMULA

=IF(OR(WEEKDAY(date,1)=1,WEEKDAY(date,1)=7),value_if_true,value_if_false)

ARGUMENTS
date: A date that you want to test if it falls on a weekend.
value_if_true: Value to be returned if the date falls on a weekend.
value_if_false: Value to be returned if the date falls on a weekday.

EXPLANATION

This formula uses the IF, OR and WEEKDAY functions to test if a specific date falls on a weekend (Saturday or Sunday) and return a value if the test is True or False.
Click on either the Hard Coded or Cell Reference button to view the formula that has the return values directly entered into the formula or referenced to specific cells.

In this example the formula identifies if a date falls on a weekend through the use of a WEEKDAY and OR functions. We have selected a return type of 1 for the WEEKDAY function, meaning if the WEEKDAY function returns a value of 1 or 7 it represents Sunday or Saturday, respectively. If the WEEKDAY function returns a value of either 1 or 7 the formula will return a text value of "Weekend" otherwise it will return a text value of "Weekday", through the use of the IF function. Two of the three dates in this example fall on a weekend and one falls on a weekday.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to test if a date is equal to another date and return a value if the test is True or False

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel IF function performs a test on specified conditions entered into the formula and returns a specified value if the result is TRUE or another specified value if the result is FALSE
The Excel WEEKDAY function returns a number between 1 and 7, representing the day of the week based on the return type that has been selected
The Excel OR function performs a test on two or more conditions and returns a TRUE result if one of the conditions was met or a FALSE result if all of the specified conditions were not met