+ Reply to Thread
Results 1 to 2 of 2

trying to calculate regular days in date range excluding holidays

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252

    trying to calculate regular days in date range excluding holidays

    I have a date range in one cell and I'm trying to figure out how many days there are from that date to the first of that year. To do that I do the following:

    =E2-("01/01/"&YEAR(E2))

    That seems to work but I would like to exclude dates a lot like the NETWORKDAYS function allows you to do. It allows you to not count the dates from particular cells if they have passed already thus allowing you to exclude holidays. Any help is more than appreciated, thanks in advance.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    I'd probably use

    =E2-DATE(YEAR(E2),1,1)

    I take it that you don't want to exclude Saturdays and Sundays from this count, just days listed in a range. Assuming that range is Z1:Z10 try

    =E2-DATE(YEAR(E2),1,1)-SUMPRODUCT(--(Z1:Z10>DATE(YEAR(E2),1,1)),--(Z1:Z10<=E2))

    Note: when you use E2-DATE(YEAR(E2),1,1) you are just counting the days difference not the inclusive days, e.g. if E2 is 2nd January the result is 1.....so when you are excluding days my assumption is that you don't check the start date, otherwise if both 1st and 2nd January were date to be excluded your result would be -1

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1