+ Reply to Thread
Results 1 to 7 of 7

Need help adding "networkdays" to an existing formula

  1. #1
    Registered User
    Join Date
    02-14-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Need help adding "networkdays" to an existing formula

    I'm not intuitive enough to figure out how to add this in, and Googling and searching existing threads in various Excel forums (including this one) didn't answer my question.

    Here's my existing formula: =IF(LEN(J1790)=0,INT(K1790-NOW()),"") Where Column J is the date received for Document B and Column K is the required due date for Document B.


    It was written by our IT guy, but he works off-site and we don't see him that often, besides, it's good for me to understand these things myself (at least a little). At any rate, the formula does a fabulous job of determining when document A was submitted, and if document B is submitted in 21 days or under of Document A. Unfortunately, it doesn't take into consideration weekends and holidays, and so it can appear as if the vendors are late, when really they aren't.

    Thanks in advance!

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Need help adding "networkdays" to an existing formula

    Try

    =IF(J1790="",networkdays(K1790,today()),"")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need help adding "networkdays" to an existing formula

    that implies that date and time is relevant as now() =date and time whereas today() is just date is that correct?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    02-14-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need help adding "networkdays" to an existing formula

    Quote Originally Posted by martindwilson View Post
    that implies that date and time is relevant as now() =date and time whereas today() is just date is that correct?
    I guess I should have included all of the associated columns. I hope I'm answering your question correctly, the time isn't really relevant on any of these, just the date itself. So it doesn't have to be "now" specifically, is there a "today" or "current" or something that will work for the current date? (I didn't write the original formula, and am still in babyhood re: the more complex formulas).

    Ace's formula comes close, but doesn't cause my "yes/no" column to properly change based on whether it's late or not. I apologize, I mistakenly assumed that my related columns would automatically change if I fixed the "days til due" column, (which is where the original formula resides). At any rate, there are five related columns, which combined return information regarding the two documents. The first is the date Document A arrives and it has no formula . The second is the "days til due" column, which contains the formula I included in the original post, it counts down the 21 days and turns color as the document approaches the due date and is overdue. The third is the "submitted by due date" column which returns a Yes (unformatted), or a No (with pink cell and red font). Its formula is: =IFERROR(IF(K6-J6>0,"Yes","No"),"")

    The fourth column contains the date for the matching Document B arrival and it contains a formula which allows the appropriate document A to be matched to document B based on entries in a separate worksheet (sorry I know this is complicated). That one is necessary because the filenames between the two don't always contain easily matchable data (thank you vendors!). They have changed them recently so that they match up better, but the matching formulas are still necessary.

    The last column is simply the date Document A arrives +21. There are also a number of index columns which help break down the parts of the documents' (half excel files, half pdf files) filenames. They're named based on their specific job number, parts number, etc (vendor choice, not ours). The spreadsheets' filenames contain the job number, the shipping number and unique number identifier. The pdf files contain a grouping of Document As and while they normally have the job number in common with the spreadsheets some of the other parts of the filenaming convention don't match, which is where the index columns and secondary spreadsheet comes into play (this may be more complex than what can be accomplished here?).

    I actually made a quick and dirty fix to this for now. I changed the simple formula in the fifth column to +28 instead of +21
    (based on an average 21 day period containing ~3 weekends). Then I created some hidden columns so I can spot check for networkdays correctness
    . It seems to be correct so far. That's okay for now, but I'd really like it to be a "real" formula since of course not all 21 day periods will contain the same number of weekends.

    At any rate, if this is too confusing for what can be accomplished I'll understand.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need help adding "networkdays" to an existing formula

    =IF(J1790="",networkdays(K1790,today()),"") as suggested gives -ve number of days
    if you want +ve days then it should be
    =networkdays(TODAY(),K1790,A1:A10)-1 where a1:a10 is holidays
    ( minus 1 because network days is inclusive
    28/08/2013 Wed and today = 28/08/2013 Wed networkdays(TODAY(),K1790,A1:A10) would give 1 when it should be 0)
    Last edited by martindwilson; 08-21-2013 at 05:06 PM.

  6. #6
    Registered User
    Join Date
    02-14-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need help adding "networkdays" to an existing formula

    Okay, I'm an idiot. I was trying to make this WAY too hard. It's not my days til due column that I needed to re-do. I was on the right track by adding 28 days to the due date column. Anyway if it helps anyone else, here's the actual formula that was the fix. (argh).

    =workdays(c3, 21). Works perfectly and makes my other columns still return the right thing.

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Need help adding "networkdays" to an existing formula

    glad you fixed it

+ 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. Help adding VBA code to existing macro to select "today's" date
    By kennected in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2012, 09:21 PM
  2. Replies: 4
    Last Post: 01-27-2012, 10:57 PM
  3. "Adding columns to existing spreadsheet"?
    By colink in forum Excel General
    Replies: 4
    Last Post: 01-30-2010, 11:01 AM
  4. Adding in a "header" copy to existing macro
    By EYMatt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2008, 10:20 AM
  5. Adding "New Comment" command to all existing and new files.
    By Chris Berry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2006, 11:22 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