+ Reply to Thread
Results 1 to 8 of 8

workdays additions and cell number display

  1. #1
    Registered User
    Join Date
    09-04-2007
    Posts
    98

    Post workdays additions and cell number display

    hi guys

    how do I get cell C1 to say "0" if the dates in A1 and B1 are the same.

    ....But if they r not the same and B1 is a later date than A1 then I want the number of workdays between those dates to be displayed as a negative number. i..e
    If

    A1=20 Sept 07
    B1=24Sept 07

    I want cell C1 = -3 (as a negative number) (which is the number of workdays difference between those dates).

    However, if

    A1 = 24 Sept 07
    B1 = 20 Sept 07

    I want C1 = 3 (as a positive number) (which is the number of workdays difference between those dates).

    This is all so that I can get a sum of all the workdays differences between a number of dates in another cell (somewhere else in the spreadsheet) to indicate whether a certain task/project is x number of days behind or ahead of schedule.

    Thanks for taking time out to read this. Awaiting your kind response.

    Regards

  2. #2
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664
    Hi there,

    Try this: =IF(A1=B1,0,IF(B1>A1,A1-B1+1,A1-B1-1))

    HTH,

    SamuelT
    Last edited by SamuelT; 09-07-2007 at 06:02 AM.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    If you're counting workdays then the easiest function to use is NETWORKDAYS (which is part of Analysis ToolPak add-in unless you're using Excel 2007).

    Use the formula

    =IF(A1=B1,0,NETWORKDAYS(B1,A1))

    to install Analysis ToolPak, Tools > addins > tick "Analysis ToolPak"

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    I agree with DLL but you should be wary about using that exact formula as it can lead to an inconsistency in results in that if the day is the same it returns 0 (the first part of the If), but if the days are 1 day apart eg 20/9/2007 and 21/9/2007 the formula will return 2 (as result of Networkdays).

    Richard

  5. #5
    Registered User
    Join Date
    09-04-2007
    Posts
    98

    Post NEtworkdays

    Thanks Guys

    IS there is a way around the problem of networkdays function making excel think of the extra day. this is also a problem when both dates are the same and it returns a value of 1. I can get round the problem of it return the value of one by specifying that if the dates are the same then return "0" but how can I ensure the if the dates are 1 day apart then it returns a value of 1 rather than the 2 that it does return.??

    Thanks,

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Perhaps:

    =NETWORKDAYS(B1,A1)-SIGN(NETWORKDAYS(B1,A1))

    Richard

  7. #7
    Registered User
    Join Date
    09-04-2007
    Posts
    98

    Post Networkdays

    Richard

    Its working fine that way.

    Many Thanks!!

    Regards

  8. #8
    Registered User
    Join Date
    09-04-2007
    Posts
    98

    Post networkdays

    sorry If I didnt clarify...

    its now working the way you have suggested as:

    =NETWORKDAYS(B1,A1)-SIGN(NETWORKDAYS(B1,A1))

    thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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