+ Reply to Thread
Results 1 to 18 of 18

Date minus a date formula

  1. #1
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Date minus a date formula

    Hi,
    I am trying to add a formula that will give me the amount of days overdue by subtracting two dates:

    example

    Column D3 has 20/02/2008
    Column D4 has 20/02/2009

    how can I formulate a sum to give me the number of days overdue?

    How can I formulate a sum to then give me the number of plus days?

    Thanks

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Date minus a date formula

    Hi,

    How about this:

    =IF(D4>D3,DATEDIF(D3,D4,"d")&" Overdue",DATEDIF(D4,D3,"d")&" Plus days")
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    Another alternative:

    =ABS(D4-D3)&IF(D4>D3," Days Overdue"," Plus Days")

  4. #4
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Wink Re: Date minus a date formula

    Hi, thanks for that its great but I now would like to know how many days too the next due date.

    I have attached an example.

    Its the #NUM! bit I would lit to show how many days until the next due date.

    Thanks all
    Attached Files Attached Files
    Last edited by Sharr76; 05-29-2009 at 02:40 AM.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    Post an XL file - not a PDF.

  6. #6
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Re: Date minus a date formula

    Ok I changed the file type..

    Thanks

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    the formula you have entered is incorrect... ie your first IF criteria is referencing incorrect cells, you should seemingly be comparing columns (A to B) not rows (1 to 2)

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    DATEDIF is available up to XL2007 AFAIK but it is not listed as available or shown in Help etc... I would be surprised if MS were to deprecate altogether given issues it would cause.

  9. #9
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Re: Date minus a date formula

    Quote Originally Posted by DonkeyOte View Post
    the formula you have entered is incorrect... ie your first IF criteria is referencing incorrect cells, you should seemingly be comparing columns (A to B) not rows (1 to 2)

    Im using this formula: =IF(A2>A1,DATEDIF(A1,B1,"d")&" Days Overdue",DATEDIF(B1,A1,"d")&" Plus days")

    Which is right, the attachment has been cut down to three columns

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    Really, A2 > A1 is correct ? Are you sure A2 shouldn't in fact be B1 ... ?

  11. #11
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Re: Date minus a date formula

    Quote Originally Posted by DonkeyOte View Post
    Really, A2 > A1 is correct ? Are you sure A2 shouldn't in fact be B1 ... ?
    Well now you got me really confused I cant get it to work at all now....

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    Well, either:

    =IF(B1>A1,DATEDIF(A1,B1,"d")&" Days Overdue",DATEDIF(B1,A1,"d")&" Plus days")

    or

    =ABS(B1-A1)&IF(B1>A1," Days Overdue"," Plus Days")

  13. #13
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Re: Date minus a date formula

    Quote Originally Posted by DonkeyOte View Post
    Well, either:

    =IF(B1>A1,DATEDIF(A1,B1,"d")&" Days Overdue",DATEDIF(B1,A1,"d")&" Plus days")

    or

    =ABS(B1-A1)&IF(B1>A1," Days Overdue"," Plus Days")

    Ok thanks for that, its works fine, but its not showing the plus days, I have attached a proper example.

    Lines one and three are showing as overdue, when they should be Plus Days
    Attached Files Attached Files

  14. #14
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    You will need to explain the logic as to why they should be showing as Plus Days given the dates in B exceed the dates in A in all rows -- ie all would appear to be Overdue.

  15. #15
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    If based on arbitrary entry in G then:

    =ABS(E1-D1)&IF(G1="Overdue"," Days Overdue"," Plus Days")

  16. #16
    Registered User
    Join Date
    11-30-2007
    Location
    Lancashire, UK
    MS-Off Ver
    1908
    Posts
    62

    Re: Date minus a date formula

    Quote Originally Posted by DonkeyOte View Post
    You will need to explain the logic as to why they should be showing as Plus Days given the dates in B exceed the dates in A in all rows -- ie all would appear to be Overdue.
    Well I was hoping that there was a formula that would do both.....the reason why I want to show this is so as the column will update itself if the right forumla is in it...this document is available to some employees. I would like a formula in that section to show something..... if its possible...

  17. #17
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Date minus a date formula

    I'm afraid I'm completely lost - I don't see how if all dates in B are greater than the dates in A some should be seen by XL as being Overdue and others not, there is no discernible logic.

+ 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