> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# VBA IsBusinessDay() Function
- URL: https://nolongerset.com/vba-isbusinessday-function/
- Published: 2021-02-03T03:15:59.000Z
- Updated: 2026-05-08T12:51:42.000Z
- Description: A simple function that returns True except for weekends and US federal holidays.
- Author: Mike Wolfe
- Tags: Code Library, #Date Functions, #Import 2026-05-20 02:59

### Business days

Oftentimes when dealing with dates, we may want to know whether a given day is a business day or not. For most purposes, a business day is any day except for the following:

- Saturday
- Sunday
- Federal Holiday

### Identifying federal holidays

Identifying Saturdays and Sundays is easy. The trickier part is identifying whether a given date is a federal holiday. In my [article yesterday](https://nolongerset.com/federal-holidays-in-vba/), I shared a brute-force function that returns a collection of US federal holidays between two dates. 

### The IsFederalHoliday() function

To test if a specific date is a federal holiday, we can call that function with the same start and end date and then check the Count property of the returned collection.

```vba
'Requires FederalHolidays() function available at:
'      https://nolongerset.com/calculating-holidays-in-vba/
Function IsFederalHoliday(AsOf As Date) As Boolean
    IsFederalHoliday = (FederalHolidays(AsOf, AsOf).Count = 1)
End Function
```

### The IsBusinessDay() function

With the IsFederalHoliday() function in place, we can now add some Saturday/Sunday checks to identify whether a given date is a business day.

In my particular use case, I sometimes needed to treat Saturdays as business days. For example, bank branches are often open on Saturdays, but closed on Sundays and federal holidays. So, I added an optional flag to the IsBusinessDay() function in case we want to treat Saturdays as business days.

```vba
Function IsBusinessDay(AsOf As Date, Optional CountSatAsBusDay As Boolean = False) As Boolean
    Select Case Weekday(AsOf)
    Case vbSunday
        IsBusinessDay = False
    Case vbSaturday
        If Not CountSatAsBusDay Then
            IsBusinessDay = False
        Else
            IsBusinessDay = True
        End If
    Case Else
        IsBusinessDay = True
    End Select
    If IsBusinessDay Then
        'Make sure it's not a Federal Holiday
        IsBusinessDay = (Not IsFederalHoliday(AsOf))
    End If
End Function
```

## The Code

The code below combines the two functions above. This version of the code also includes [Python-inspired doc tests](https://nolongerset.com/python-inspired-doc-tests-in-vba/). Note that you will also need a copy of the [FederalHolidays() function](https://nolongerset.com/calculating-holidays-in-vba/). 

```vba
'---------------------------------------------------------------------------------------
' Procedure : IsBusinessDay
' Author    : Mike
' Date      : 11/20/2014
' Purpose   : Returns True if the AsOf date is a business day.
' Notes     - Sundays always return False.
'           - Saturdays return False by default, but optional param allows that to be changed.
'           - Federal Holidays (as published by OPM) return False.
'           - All other days return True.
'>>> IsBusinessDay(#9/11/2001#)
' True
'>>> IsBusinessDay(#12/25/2014#)
' False
'>>> IsBusinessDay(#5/29/2010#) Or IsBusinessDay(#5/30/2010#) Or IsBusinessDay(#5/31/2010#)
' False
'---------------------------------------------------------------------------------------
'
Function IsBusinessDay(AsOf As Date, Optional CountSatAsBusDay As Boolean = False) As Boolean
    Select Case Weekday(AsOf)
    Case vbSunday
        IsBusinessDay = False
    Case vbSaturday
        If Not CountSatAsBusDay Then
            IsBusinessDay = False
        Else
            IsBusinessDay = True
        End If
    Case Else
        IsBusinessDay = True
    End Select
    If IsBusinessDay Then
        'Make sure it's not a Federal Holiday
        IsBusinessDay = (Not IsFederalHoliday(AsOf))
    End If
End Function

'>>> IsFederalHoliday(#7/4/2019#)
' True
'>>> IsFederalHoliday(#7/3/2019#)
' False
'>>> IsFederalHoliday(#7/4/2020#)
' False
'>>> IsFederalHoliday(#7/3/2020#)
' True
Function IsFederalHoliday(AsOf As Date) As Boolean
    IsFederalHoliday = (FederalHolidays(AsOf, AsOf).Count = 1)
End Function
```

*Image by [Free-Photos](https://pixabay.com/photos/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=690084) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=690084)*

***UPDATE*** *\[2023-02-15\]: Updated to use the [FederalHolidays](https://nolongerset.com/calculating-holidays-in-vba/)() function instead of [FedHolidays](https://nolongerset.com/federal-holidays-in-vba/)() function because of the wider range of acceptable start and end dates.*