+ Reply to Thread
Results 1 to 7 of 7

Calculate amount of months between 2 "dates" with extra parameter

  1. #1
    Registered User
    Join Date
    07-31-2017
    Location
    Belgium
    MS-Off Ver
    MS2013
    Posts
    6

    Calculate amount of months between 2 "dates" with extra parameter

    Hello all,

    I've been given an excell file where I need to automatically calculate the amount of months between two dates.
    The first catch is that the dates are not written in the standard date format but like this: 201603 (the year with the month following it, no days)
    I've managed to come up with a way to calculate the amount of months between yet struggle when I want to add another parameter.
    I need to calculate it per year too. (it only needs to count the amount of months of one year, like when the dates inputted are 201601 - 201705 it only needs to tell me the amount of months in 2016)

    For example:
    The info that is in the excel file: 201608____201703 (= 8 months)

    What I need excel to do and show:
    First column: 5 months (excel needs to calculate with these numbers: 201608_____201612)
    Second Column: 3 months (excel needs to calculate with these numbers: 201701______201703 = )

    Is this possible?

    Thank you in advance and best regards,

    M.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,209

    Re: Calculate amount of months between 2 "dates" with extra parameter

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-31-2017
    Location
    Belgium
    MS-Off Ver
    MS2013
    Posts
    6

    Re: Calculate amount of months between 2 "dates" with extra parameter

    My apologies, added the excel file here.

    Another time my apologies but I only managed to make the formula to calculate it for the entire period: 1+((LEFT(C5,4)-LEFT(B5,4))*12+(RIGHT(C5,2)-RIGHT(B5,2)))

    (edited after Pete's remark, sorry Pete, I should have seen that).
    Attached Files Attached Files
    Last edited by Jobstudent; 07-31-2017 at 07:01 AM.

  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,427

    Re: Calculate amount of months between 2 "dates" with extra parameter

    Your example is misleading, as in row 11 you don't have any months in 2018.

    Will the span of years always be a maximum of 2, or might you have some dates from 2016 to 2018, or even longer?

    Pete

  5. #5
    Registered User
    Join Date
    07-31-2017
    Location
    Belgium
    MS-Off Ver
    MS2013
    Posts
    6

    Re: Calculate amount of months between 2 "dates" with extra parameter

    Apologies, I made this during work. No time and too much work, it's stressing me out :/

    Attached the version with updated headers.

    The idea is that it will start in 2016 all the way until (and included) 2020.
    However most periods will never go over 2 years. The maximum amount of years I can find back in my files is 2 years (for example 201503---201610)
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,209

    Re: Calculate amount of months between 2 "dates" with extra parameter

    Why don't you enter the start and end dates as proper dates, but custom formatted to the format you want? It would make your life a lot less stressful!

  7. #7
    Registered User
    Join Date
    07-31-2017
    Location
    Belgium
    MS-Off Ver
    MS2013
    Posts
    6

    Re: Calculate amount of months between 2 "dates" with extra parameter

    Yeah I get this huge excel file from a coworker and well I just started at the company and they used this method for some time now...
    I could change it though in my files, no one would bat an eye I guess, if the results are correct that is :p

    Then I would use the formula '=1+(YEAR(LDate)-YEAR(EDate))*12+MONTH(LDate)-MONTH(EDate)

    But how would I then be able to filter it to only calculate it for one year instead of the entire period?

    Attached the excel with normal dates.
    Attached Files Attached Files

+ 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: 2
    Last Post: 09-16-2012, 01:58 PM
  2. Replies: 1
    Last Post: 01-19-2011, 04:50 AM
  3. [SOLVED] Need "reverse" amortization; calculate loan amount
    By Niek Otten in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 AM
  4. [SOLVED] Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. [SOLVED] Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. [SOLVED] Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  8. Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-27-2005, 12:05 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