+ Reply to Thread
Results 1 to 4 of 4

need date/time difference with multiple variables

  1. #1
    Registered User
    Join Date
    09-24-2007
    Posts
    66

    need date/time difference with multiple variables

    I need help and im not sure where to start. I have a very large spreadsheet that I need to calculate the difference between 2 dates dependant on times.
    My variables are:
    if before 2p and same day = "0"
    if after 2p and same day = "-1"
    if after 2p and next day = "0"
    if after 2p and not the next day = # of days past 1
    if before 2p and not the same day = # of days past 1
    Plus I need to take into account networkdays (weekends and holidays)

    Can this even be done? Ive been playing around with if(and), if(or) and networkdays all day, but I cannot get everything.example.xlsx

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: need date/time difference with multiple variables

    I've got this so far:

    =IF(AND(DAYS360(A2,S2)=0,TEXT(A2,"hh:mm")*1<"14:00"*1),0,IF(DAYS360(A2,S2)=0,-1,IF(AND(DAYS360(A2,S2)=1,TEXT(A2,"hh:mm")*1<"14:00"*1),1,IF(DAYS360(A2,S2)=1,0,""))))

    Which works fine for the first three conditions.

    Are the last 2 supposed to be different formulas? They appear to read the same. According to your previous logic, "if after 2p and not next day" should be networkdays -2, and "if before 2pm and not next day" should be networkdays -1.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    09-24-2007
    Posts
    66

    Re: need date/time difference with multiple variables

    Yes .. those are the 2 that keep tripping me up.
    If imported after 2p and not shipped the next business day, the 2nd business day = 1, 3rd business day = 2, and so on
    If imported before 2p and shipped not the same day, the 1st business day = 1, 2nd business day = 2, and so on

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: need date/time difference with multiple variables

    V2 and copy down:

    =IF(AND(NETWORKDAYS(A2,S2,$X$2:$X$6)-1=0,TEXT(A2,"hh:mm")*1<"14:00"*1),0,IF(NETWORKDAYS(A2,S2,$X$2:$X$6)-1=0,-1,IF(AND(NETWORKDAYS(A2,S2,$X$2:$X$6)-1=1,TEXT(A2,"hh:mm")*1<"14:00"*1),1,IF(NETWORKDAYS(A2,S2,$X$2:$X$6)-1=1,0,IF(AND(NETWORKDAYS(A2,S2,$X$2:$X$6)-1>1,TEXT(A2,"hh:mm")*1<"14:00"*1),NETWORKDAYS(A2,S2,$X$2:$X$6)-1,NETWORKDAYS(A2,S2,$X$2:$X$6)-2)))))

+ 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. Calculation of time difference between the Start date & time & End Date & time
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-17-2012, 03:54 PM
  2. [SOLVED] Caculating the Time difference from Start & end date/time excludin weekends & non ofce hrs
    By Harry Jones in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-08-2012, 06:25 AM
  3. [SOLVED] Subtract date/time from data/time and get difference in minutes
    By zit1343 in forum Excel General
    Replies: 2
    Last Post: 06-18-2012, 11:23 AM
  4. Time Difference in hours between two date time stamps
    By Cipher in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2010, 10:24 AM
  5. Replies: 2
    Last Post: 12-19-2005, 08:45 AM

Tags for this Thread

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