+ Reply to Thread
Results 1 to 2 of 2

Calculating Months between two dates Pls Help I'm going mad!

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    australia
    MS-Off Ver
    Excel 2000
    Posts
    1

    Calculating Months between two dates Pls Help I'm going mad!

    I've got a sheet where I'm tracking when to update certain forms etc.
    The formula I am using is
    =IF(H6="","",(YEAR(AB7)-YEAR(H7))*12+MONTH(AB7)-MONTH(H7))

    H6= Date due for Revision
    AB6= Todays Date (this updates each time the sheet is opened)

    H6= 2/11/2009
    AB6= 28/7/2011 (Todays date)

    The document is overdue for revision by years, however the result of my formula is 29 instead of -29

    If I write the formula as
    =IF(H6="","",(YEAR(H7)-YEAR(AB7))*12+MONTH(H7)-MONTH(AB7))
    Then I get the correct result.

    The formula works great, however the Date due for revision is not always current or in the future, sometimes it is in the past which is causing the formula not to pick up the negative figures when neccesary. These dates will always be changing so I can't just simply swap the order of the cells that are being deducted from each other as I please. I need something that works correctly no matter the order of the dates.

    I hope this makes sense

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

    Re: Calculating Months between two dates Pls Help I'm going mad!

    use the first one and just multiply it by 1 or -1
    =IF(H6="","",(YEAR(AB7)-YEAR(H7))*12+MONTH(AB7)-MONTH(H7))*if(H7<AB7,-1,1)
    "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

+ 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