XLA routines: EE_IsBusinessDay

Nick's picture
EE_IsBusinessDay is a very useful financial function that returns whether a date is a business day. To use the function, pass in a range containing the holidays that you want the function to consider as non-business days
Function EE_IsBusinessDay(rngHolidays As range, dt As Date) As Boolean
'Takes a range containing a list of holidays, and a date, and returns if the day is a business day.
    Dim rngDate As range
 
'http://excelexperts.com/xla-routines-eeIsBusinessDay    for updates on this function

    For Each rngDate In EE_RangeTrim(rngHolidays)
        If CDate(rngDate) = dt Then
            EE_IsBusinessDay = False
            Set rngDate = Nothing
            Exit Function
        End If
    Next rngDate
    EE_IsBusinessDay = EE_IsWeekday(dt)
    Set rngDate = Nothing
End Function