# How to Determine If a Date Falls on the Weekend

This post will guide you how to determine if a date falls on the weekend in Excel. How do I check if a date falls on the weekend with a formula in Excel. How to check if a date is a weekend in Excel.

## 1. Check if a Date Falls on the Weekend

Assuming that you have a list of data that contain dates in range A1:A5, and you want to check each date if it falls on the weekend. How to achieve it. You can create a formula based on the IF function, the OR function and the WEEKDAY function. Just like this:

``=IF(OR(WEEKDAY(A1)=1,WEEKDAY(A1)=7),TRUE,FALSE)``

Type this formula into Cell B1, and press Enter key in your keyboard, and then drag the AutoFill Handle from Cell B1 to B5.

This formula will check if a date falls on the weekend, it will return TRUE, otherwise, it will return FALSE.

## 2. Determine If a Date Falls on the Weekend Using a VBA Macro

In this tutorial, we’ll utilize a VBA macro to identify weekend dates. Just do the following steps:

Step1: Press Alt + F11 to open the VBA editor in Excel.

Step2: In the VBA editor, go to “Insert” in the menu and select “Module.” This is where we’ll write our VBA code.

Step3: copy and paste the VBA code for identifying weekend dates into the module. This code will loop through your data and mark the weekend dates.

``````Sub IdentifyWeekendDatesInRange()
Dim DateCell As Range
Dim TargetRange As Range
Dim WeekendColor As Long
Dim WeekdayValue As Integer

' Prompt the user to select a range
On Error Resume Next
Set TargetRange = Application.InputBox("Select the range of dates:", Type:=8)
On Error GoTo 0

If TargetRange Is Nothing Then
MsgBox "No range selected. Exiting the macro.", vbExclamation
Exit Sub
End If

' Define the color you want to use for highlighting weekend dates
WeekendColor = RGB(255, 0, 0) ' Adjust the RGB color as desired

' Loop through each cell in the selected range
For Each DateCell In TargetRange
WeekdayValue = Weekday(DateCell.Value, vbSunday)
If WeekdayValue = 1 Or WeekdayValue = 7 Then
' Check if the date is a Sunday (1) or Saturday (7)
DateCell.Interior.Color = WeekendColor ' Highlight weekend dates
Else
DateCell.Interior.ColorIndex = xlNone ' Remove any previous highlighting
End If
Next DateCell
End Sub
``````

Step4: Close the VBA editor and return to your Excel worksheet. To run the macro, press Alt + F8, select “IdentifyWeekendDatesInRange,” and click “Run.”

This macro will prompt you to select a range containing dates.

It will then identify weekend dates within the selected range and highlight them in red.

## 3. Video: Determine If a Date Falls on the Weekend

In this video tutorial, we’ll tackle the task of determining whether a date falls on the weekend in Excel.

## 4. Related Functions

• Excel IF function
The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
• Excel WEEKDAY function
The Excel WEEKDAY function returns a integer value representing the day fo the week for a given Excel date and the value is range from 1 to 7.The syntax of the WEEKDAY function is as below:=WEEKDAY (serial_number,[return_type])…
• Excel OR Function
The Excel OR function used to test multiple conditions and returns TRUE if any of the conditions are TRUE.The syntax of the OR function is as below:=OR(logical1, [logical2], …)…