+ Reply to Thread
Results 1 to 4 of 4

Negative Datedif

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2007
    Posts
    88

    Negative Datedif

    I want to find the difference between two dates in months. I can do this by using the datedif formula, however I need this to have the ability to give a negative difference. If it is negative it brings back an error in the cell, can I not use datedif if the difference is negative?

  2. #2
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    datedif is not on this computer but perhaps something like

    =if(a1>b1,datedif(a1,b1,"mm"),-datedif(b1,a1,"mm"))

    Regards

    Dav

  3. #3
    Registered User
    Join Date
    02-12-2007
    Posts
    88
    Quote Originally Posted by Dav
    datedif is not on this computer but perhaps something like

    =if(a1>b1,datedif(a1,b1,"mm"),-datedif(b1,a1,"mm"))

    Regards

    Dav
    That is pure genious mate!!! Thanks very much!!!!

    People pay for advice like that

  4. #4
    Registered User
    Join Date
    10-22-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Negative Datedif

    I was trying to do something similar but not quite. The solution above didn't work for what I was doing, and I couldn't find a solution anywhere but this is what finally worked:

    =IFERROR(DATEDIF(D5,"01/01/2014","M"),-DATEDIF("01/01/2014",D5,"M"))

    where D5 contains the date I'm comparing to 1/1/14

    If D5 = 3/1/2014 the result is -2
    If D5 = 3/1/2013 the result is 10

    -Paul Falcon

+ 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