+ Reply to Thread
Results 1 to 8 of 8

Date to Date Calculation in Months

  1. #1
    Registered User
    Join Date
    03-27-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Date to Date Calculation in Months

    I want to calculate the total months between a date "10/10/2007" and today's date using the TODAY() argument and I want to use one cell. That is I don't want to use extra cells for 10/10/2007, TODAY(), and the cell with a formula, which is currently "=(YEAR(D3)-YEAR(C3))*12+MONTH(D3)-MONTH(C3)".

    I've tried using the "=DATEDIF(10/10/2007,TODAY(),"m")" formula, which returns a calculation of 1370, which I think is a date of 10/01/1903. How do I get the formula to calculate correctly? The calculation should actually be "77" which is the total months between 10/10/2007 and today! Thank you...

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Date to Date Calculation in Months

    Here is the formula: =DATEDIF("10 Oct 2007",TODAY(),"m")

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,650

    Re: Date to Date Calculation in Months

    Try:
    =DATEDIF("10/10/2007",TODAY(),"m")
    Quang PT

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,413

    Re: Date to Date Calculation in Months

    The formula will take your 10/10/2007 and interpret that as meaning 10 divided by 10 and then divided by 2007, which equates to a very small date.

    To avoid that you can write your formula like this:

    =DATEDIF(--"10/10/2007",TODAY(),"m")"

    or like this:

    =DATEDIF(DATE(2007,10,10),TODAY(),"m")

    Hope this helps.

    Pete

  5. #5
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Date to Date Calculation in Months

    Quote Originally Posted by jamezam View Post
    I want to calculate the total months between a date "10/10/2007" and today's date using the TODAY() argument and I want to use one cell. That is I don't want to use extra cells for 10/10/2007, TODAY(), and the cell with a formula, which is currently "=(YEAR(D3)-YEAR(C3))*12+MONTH(D3)-MONTH(C3)".

    I've tried using the "=DATEDIF(10/10/2007,TODAY(),"m")" formula, which returns a calculation of 1370, which I think is a date of 10/01/1903. How do I get the formula to calculate correctly? The calculation should actually be "77" which is the total months between 10/10/2007 and today! Thank you...
    Please Login or Register  to view this content.
    For the date 10/10/2007, it is performing a calculation, 10 divided by 10 = 1, divided by 2007 = 0.00049826

    So, you need to put the date in double quotes so it is treated as text, and in this case it reads it as a date

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to Date Calculation in Months

    Hi,

    The
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    function works for me. Are you able to share your workbook with us?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Date to Date Calculation in Months

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    The
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    function works for me. Are you able to share your workbook with us?
    The reason it works for you is that it is treating the value in A1 as a date, OP didn't want to use additional columns

    For you to replicate what the OP was seeing you would have to enter =10/10/2007 into your A1 cell, rather than just 10/10/2007

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Date to Date Calculation in Months

    @thirtytwo

    Indeed so. It just strikes me as odd when anyone wants to hard code values in formulae (or macros for that matter), when it seems no hardship to use a cell somewhere that carries the variable / constant.

+ 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. [SOLVED] Add date + 3 months in vba so the VBA sends mail reminder exactly 3 months before due date
    By JimmyQ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2014, 08:54 AM
  2. Progressive calculation based on date and months Update required
    By Christopherdj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2012, 07:04 PM
  3. Given a date......find the same date two months prior to the given date
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2012, 11:24 PM
  4. Progressive calculation based on date and months
    By Christopherdj in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-12-2012, 07:08 PM
  5. Replies: 2
    Last Post: 01-04-2012, 09:15 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