+ Reply to Thread
Results 1 to 4 of 4

Statement to search date range and eliminate weekends and holidays

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    Anderson, IN
    MS-Off Ver
    Excel 2010
    Posts
    2

    Statement to search date range and eliminate weekends and holidays

    Hello,

    I'm trying to search data from another program with and IF statement and filter out dates and times. I have a mm/dd/yy hr:mm format in a series of cells. I've converted that to hh:mm using the MOD command. I also have a range of data that corresponds to each date in the next cell range. So far, I use this formula to evaluate the date:time cells for anything that is greater than 9:00 and less than 21:00. If this situation occurs, then I want it to show the corresponding data in the adjacent cell, otherwise leave blank.

    For cell F37 formula is =IF((E37>TIME(8,59,0)+0)*(E37<TIME(21,1,0)),B37," ")

    this works exactly as I want EXCEPT, I want to eliminate all weekends and holidays as well. What would I add to this formula to not only evaluate based on time, but on weekends and holidays as well.

    Thanks in advance for any help.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Statement to search date range and eliminate weekends and holidays

    Hi rmnuce and welcome to the forum,

    Excel has a Weekday() function that will return the Day of the Week number that might help in your formula(s). There is also a function called
    Workday() that takes a list of holidays you can specify. My thinking is you can use either or both of these built-in functions to get to your desired answer.
    http://social.msdn.microsoft.com/For...forum=exceldev
    http://office.microsoft.com/en-us/ex...010343038.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-14-2014
    Location
    Anderson, IN
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Statement to search date range and eliminate weekends and holidays

    thanks for the quick input. I was able to get this formula to work for me, although it does not take into account holidays. I ended up using an IF(OR statement against the list of holidays in another cell that is doing the job for me.

    =IF(AND(OR(WEEKDAY($A3)<>1),OR(WEEKDAY($A3)<>7),($E3>TIME(8,59,0)+0)*($E3<TIME(21,1,0))),$B3," ")

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Statement to search date range and eliminate weekends and holidays

    You can use NETWORKDAYS function to evaluate whether a date is a working day or not, e.g. with holiday dates in H2:H10 this formula

    =NETWORKDAYS($A3,$A3,$H$2:$H$10) will return 1 if A3 is a working day or zero uf it's a weekend or holiday.....so your formula can be as follows:

    =IF(AND(NETWORKDAYS($A3,$A3,$H$2:$H$10)=1,$E3>TIME(8,59,0),$E3<TIME(21,1,0)),$B3,"")
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 10
    Last Post: 02-29-2024, 08:55 AM
  2. [SOLVED] Determine End Date that omits weekends and holidays
    By mrh_consulting in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-14-2012, 11:44 PM
  3. display date, excluding weekends & holidays
    By emueller in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-10-2008, 03:55 PM
  4. Calculate A Date Excluding Weekends And Holidays
    By travelersway in forum Excel - New Users/Basics
    Replies: 9
    Last Post: 02-08-2006, 09:36 PM

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