+ Reply to Thread
Results 1 to 3 of 3

Easier way to Calculate # Days Early or Late Between Dates w/NETWORKDAYS formula

  1. #1
    Registered User
    Join Date
    02-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Easier way to Calculate # Days Early or Late Between Dates w/NETWORKDAYS formula

    I am trying to calculate the # Days an order is Early or Late and am think I've figured out one way and am hoping for confirmation and also to find out if there is a better or easier way.

    My data is set up:
    Column D = Order Date
    Column E = Due Date
    Column F = Completed Date

    I would like to exclude the Due Date from the count. i.e. If an order is received on the Due Date then the result should be "0". If it is received the day after the Due Date it should be "1" or if it is received the day before the Due Date it should be "-1".

    I have a tab labeled Holidays with the dates in Column B. Using this formula:
    =IF((NETWORKDAYS(E255,F255,Holidays!$B$3:$B$1000))<=0,(NETWORKDAYS(E255,F255,Holidays!$B$3:$B$1000)+1),(NETWORKDAYS(E255,F255,Holidays!$B$3:$B$1000)-1))

    With the following data:
    d2 = 02/04/13
    e2 = 02/07/13
    f2 = 02/07/13 (There are no holidays during the period 2/4/13 - 2/8/13.)

    It seems to work properly. If f2 = 2/06/13 it returns "-1", if f2 = 2/07/13 it returns "0", and if f2 = 2/08/13 it returns "1".

    Is there a better way to do this? I try to use the "KISS" rule (Keep It Simple Stupid) but this seems a bit convoluted.

    Any feedback is appreciated.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Easier way to Calculate # Days Early or Late Between Dates w/NETWORKDAYS formula

    hi dburrup, welcome to the forum. your formula seems fine. what you could save is a couple of unnecessary brackets:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and maybe reverse the logic of <=0 into >0, so that you save a single "=".

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and ermmm, why do you need 998 rows of holidays when there's only 366 days (max) a year?

    anyway, your formula should be working fine. just some little savings here & there. there might be a shorter version to surprise you & me

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

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

    Re: Easier way to Calculate # Days Early or Late Between Dates w/NETWORKDAYS formula

    One way to simplify would be to use SIGN function like this

    =NETWORKDAYS(E255,F255,Holidays!$B$3:$B$1000)-SIGN(NETWORKDAYS(E255,F255,Holidays!$B$3:$B$1000))
    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)

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