+ Reply to Thread
Results 1 to 6 of 6

Date Function

  1. #1
    Registered User
    Join Date
    06-24-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    4

    Post Date Function

    Hi,
    I am working for this project where I need to calculate number of months between two dates. For instance, I need to calculate the month between: 00-Jan-1964 and 00-Mar-1966. As you can see we don't have exact dates in them. Most of the excel functions that I found online work when I put exact dates in it. But we don't have any exact dates at our disposal. So could you suggest me any date function or a combination of functions that could help me calculate the number of months between these dates. Any help would be greatly appreciated!Thank you!!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Date Function

    Try

    Assuming start date in A1 and B1

    in C1
    =("01"&RIGHT(A1,9))+0
    in D1
    =("01"&RIGHT(B1,9))+0
    in E1
    =DATEDIF(C1,D1,"M")

    Difference is 26 months
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Date Function

    Try

    =DATEDIF(DATEVALUE(SUBSTITUTE(A1,"00","01")),DATEVALUE(SUBSTITUTE(B1,"00","01")),"m")

    A1 = Start Date

    B1=Finish Date

    so all dates are 1st of month

  4. #4
    Registered User
    Join Date
    06-24-2016
    Location
    Ohio
    MS-Off Ver
    2010
    Posts
    4

    Re: Date Function

    Thank you so much for that formula it works!
    I was wondering what will be the change in the above mentioned formula if one of the full date is given Let's say if the dates were 14-Jan-1964 and 00-Mar-1966. OR if the dates were 00-Jan-1964 and 14-Mar-1966, Thank you once again for your help!

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Date Function

    Try

    in C1
    =IF(LEFT(A1,2)="00,"01"&RIGHT(A1,9)+0,A1)
    in D1
    =IF(LEFT(B1,2)="00,"01"&RIGHT(B1,9)+0,B1)
    in E1
    =DATEDIF(C1,D1,"M")

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: Date Function

    Or try this ...

    =DATEDIF(--SUBSTITUTE(A1,"00-","01-"),--SUBSTITUTE(B1,"00-","01-"),"m")

+ 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. Replies: 0
    Last Post: 11-16-2015, 08:57 AM
  2. Replies: 4
    Last Post: 06-12-2014, 11:37 AM
  3. [SOLVED] Function/formula to compare and insert todays date or yesterdays date
    By TC922 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2013, 05:28 AM
  4. Replies: 0
    Last Post: 05-30-2013, 07:50 PM
  5. Function that will create a range based on a start date and end date
    By ckosman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-24-2013, 10:09 PM
  6. [SOLVED] Date function that compare 2 date in single column and return value
    By alimamak in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-20-2012, 06:45 AM
  7. Function to pull month-to-date, year-to-date for 2009
    By cacjr in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-14-2010, 07:57 PM

Tags for this Thread

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