+ Reply to Thread
Results 1 to 6 of 6

Automatically Generate a number of months between two dates

  1. #1
    Registered User
    Join Date
    11-14-2017
    Location
    Scotland
    MS-Off Ver
    Windows 10
    Posts
    3

    Automatically Generate a number of months between two dates

    I am looking for some help, I need to automatically generate a series of months between a start date and an end date. I am currently using the following formula which calculates in days, with A1 being the start date and A2 being the end date.

    =IF($A$1+ROW(A1)>=$A$2-1,"",C1+1)

    Any suggestions would be greatly appreciated.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Automatically Generate a number of months between two dates

    DatedIf(Start_Date,End_Date,Interval)
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Introduction To The DATEDIF Function

    The DATEDIF function computes the difference between two dates in a variety of different intervals, such as the number of years, months, or days between the dates. This function is available in all versions of Excel since at least version 5/95, but is documented in the help file only for Excel 2000. For some reason, Microsoft has decided not to document this function in any other versions. DATEDIF is treated as the drunk cousin of the Formula family. Excel knows it lives a happy and useful life, but will not speak of it in polite conversation. Do not confuse the DATEDIF worksheet function with the DateDiff VBA function.

    The syntax for DATEDIF is as follows:

    =DATEDIF(Date1, Date2, Interval)

    Where:
    Date1 is the first date,
    Date2 is the second date,
    Interval is the interval type to return.

    If Date1 is later than Date2, DATEDIF will return a #NUM! error. If either Date1 or Date2 is not a valid date, DATEDIF will return a #VALUE error.
    The Interval value should be one of

    Interval Meaning Description
    m Months Complete calendar months between the dates.
    d Days Number of days between the dates.
    y Years Complete calendar years between the dates.
    ym Months Excluding Years Complete calendar months between the dates as if they were of the same year.
    yd Days Excluding Years Complete calendar days between the dates as if they were of the same year.
    md Days Excluding Years And Months Complete calendar days between the dates as if they were of the same month and same year.

    If Interval is not one of the items listed in above, DATEDIF will return a #NUM error.

    If you are including the Interval string directly within the formula, you must enclose it in double quotes:

    =DATEDIF(Date1,Date2,"m")

    If you have the interval in another cell referenced by the formula, that cell should not have quotes around the interval string. For example, with the formula

    =DATEDIF(Date1,Date2,A1)

    cell A1 should contain m not "m".

    Source:-

    http://www.cpearson.com/excel/datedif.aspx


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-14-2017
    Location
    Scotland
    MS-Off Ver
    Windows 10
    Posts
    3

    Re: Automatically Generate a number of months between two dates

    Thank you, however what I am looking to do is generate each month between two given dates into its own individual cell.

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Automatically Generate a number of months between two dates

    Hi TamHam. Welcome to the forum.

    Do you mean output like this? With Start/End dates in A1:B1


    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    1
    1/15/2017
    9/13/2018
    January
    February
    March
    April
    May
    June
    July
    August
    September
    October
    November
    December
    Dave

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Automatically Generate a number of months between two dates

    welcome to the forum. do upload an excel sample so that we do not have to manually key in your data to do a testing.

    input the desired results so that we don't have to second-guess if what we are doing is correct or not. you may look at my signature to upload an eg that is easier to understand. post #4 from Dave is a good eg. but if it's ending in 13-Sep-2018, i suppose the months should keep repeating until it reaches sep again?

    the upload attachment must be done by going to Go Advanced. click on Manage Attachments. Choose file, upload and close the window.

    if i really guessed it wrongly, please upload something according to my recommendations. try to use the solution i have given and we'll help to advise what went wrong.

    like your eg, i assume Start Date in A1 and End Date in A2. i don't know what's in C1 though. so say formula in D1:
    =IF(EDATE($A$1,COLUMNS($D$1:D1)-1)>EOMONTH($A$2,0),"",EDATE($A$1,COLUMNS($D$1:D1)-1))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  6. #6
    Registered User
    Join Date
    11-14-2017
    Location
    Scotland
    MS-Off Ver
    Windows 10
    Posts
    3

    Re: Automatically Generate a number of months between two dates

    Thank you that is exactly what I was looking for.

+ 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. Automatically Generate Sequential Number in Following Row
    By Det2120 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2017, 10:59 PM
  2. How do I automatically generate dates in Excel?
    By Rhyso in forum Excel General
    Replies: 15
    Last Post: 03-31-2015, 10:03 AM
  3. Replies: 8
    Last Post: 02-20-2014, 05:46 PM
  4. Number of months (elapsed months) between two dates
    By Timbite in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-17-2012, 11:37 AM
  5. Replies: 1
    Last Post: 01-20-2011, 09:40 PM
  6. Input dates automatically into rows, when given number of months.
    By jaganath in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-12-2010, 03:39 PM
  7. How do I automatically generate dates?
    By alvoons28 in forum Excel General
    Replies: 1
    Last Post: 06-24-2005, 11:05 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