+ Reply to Thread
Results 1 to 10 of 10

Finding difference in days between 2 dates

  1. #1
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Finding difference in days between 2 dates

    Hi Everyone
    Not sure what's wrong with my formula but I'm getting negative figures. I'm trying to find the difference in days between 2 same dates using NETWORKDAYS formula below and it keeps returning negative values. the range in G are the list of holidays. Any help with this? I'm expecting it to return 0. Thanks.

    =(NETWORKDAYS(A1,B1,$G$1:$:$8))-1

    COLUMN A COLUMN -B COLUMN_C
    02/04/2019 02/04/2019 -1

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Finding difference in days between 2 dates

    Hi

    I suppose you are using =NETWORKDAYS(A1,B1,$G$1:$G$8)-1
    If in A1 and B1 you have 02/04/2019 the formula returns -1 if and only if in G2:G8 exists 2/04/2019.

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Finding difference in days between 2 dates

    An attachment would be easier as we can not see the values that are creating the result

    the formula appears to be missing a G and having a random : in its place
    =(NETWORKDAYS(A1,B1,$G$1:$:$8))-1

    network days when the 2 values are the same will return 1 as in one day, if this day is a holiday, it will return a 0 as no days have been worked. the same would apply if both days were a weekend, no days have been worked

    your formula takes 1 away from the networkdays calcuation, so you get an negative value.

    It might be better to say what you are wanting to achieve, as the formulas are behaving as you would expect
    Last edited by davsth; 06-24-2019 at 05:01 AM.

  4. #4
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Finding difference in days between 2 dates

    Hi Davsth, the formula seem to work fine with all same start and end dates except 22/04/2019 strangely. So for instance where I have start date 30/04/2019 and end date 30/04/2019, it returns 0

    Only 22/04/2019 for both start/end date return -1

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Finding difference in days between 2 dates

    it works for me on the 22/4/19 it is a monday, but it was easter monday, so is it included in the list of holidays?

  6. #6
    Registered User
    Join Date
    06-14-2019
    Location
    Charlotte, NC, USA
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Finding difference in days between 2 dates

    NETWORKDAYS is for business days only... is that what you want? Otherwise the DAYS() or DAYS360() functions will work as well.

  7. #7
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Finding difference in days between 2 dates

    Yes pls there is a 02/04/2019 in the lookup range because it's a holiday but was also a trading day.. Could that be the reason?
    Last edited by FredFitzgerald; 06-24-2019 at 08:56 AM.

  8. #8
    Forum Contributor
    Join Date
    03-09-2014
    Location
    Telford
    MS-Off Ver
    Microsoft 365
    Posts
    101

    Re: Finding difference in days between 2 dates

    Yes izzy, I'm looking at just business days.

  9. #9
    Registered User
    Join Date
    06-14-2019
    Location
    Charlotte, NC, USA
    MS-Off Ver
    Office 365
    Posts
    20

    Re: Finding difference in days between 2 dates

    Yes, it's returning -1 because that day is in the list of holidays. Otherwise it would return 0 if you weren't subtracting -1 from the number. You could try something like...

    Please Login or Register  to view this content.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Finding difference in days between 2 dates

    I agree with davsth.

    It's time for a workbook upload.

    Do you know how to do it?
    Dave

+ 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: 3
    Last Post: 06-21-2016, 02:15 PM
  2. How to find the difference between 2 dates in days
    By nav505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-11-2013, 07:45 AM
  3. Difference between two dates in months and days
    By pleiadeez7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2013, 01:54 PM
  4. Replies: 2
    Last Post: 05-22-2011, 06:54 PM
  5. Finding the difference between days and copying the data row to another sheet
    By maximpinto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2009, 10:11 PM
  6. difference between dates in no. of days
    By JAYLOTT in forum Excel General
    Replies: 4
    Last Post: 06-07-2007, 04:53 AM
  7. [SOLVED] difference betwwen two dates in days
    By seven in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-15-2006, 05:10 AM

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