+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Automatically creating a series of dates

Hybrid View

  1. #1
    Registered User
    Join Date
    02-02-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2016
    Posts
    48

    Automatically creating a series of dates

    I would like to create a template. This template would have 2 input cells - one to enter a month and one to enter a year (e.g. February and 2000).

    From these 2 cells I would like to automatically create a column of dates, from the 1st of that month through to the last day of that month (e.g. 1st Feb 2000, 2nd Feb 2000, through to 29th Feb 2000).

    I've managed to create the first day of the month using DATE and the last day of the month using EOMONTH. But this doesn't really get me where I need to go! Any ideas please?

    EXAMPLE:
    Enter month: 2
    Enter year: 2000

    1/02/2000
    2/02/2000
    3/02/2000
    4/02/2000
    5/02/2000
    6/02/2000
    7/02/2000
    8/02/2000
    9/02/2000
    10/02/2000
    11/02/2000
    12/02/2000
    13/02/2000
    14/02/2000
    15/02/2000
    16/02/2000
    17/02/2000
    18/02/2000
    19/02/2000
    20/02/2000
    21/02/2000
    22/02/2000
    23/02/2000
    24/02/2000
    25/02/2000
    26/02/2000
    27/02/2000
    28/02/2000
    29/02/2000
    Last edited by marketshare; 02-11-2010 at 01:46 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Automatically creating a series of dates

    Cell B2: month value (user)
    Cell B3: year value (user)

    Cell A5: =DATE(B2,B1,1)
    Cell A6: =A5+1

    Copy cell A6 down through cell A32. You now have the dates through the 28th of the month.

    Cell A33: =IF(A32="","",IF(MONTH(A32+1)>MONTH(A32),"",A32+1))

    Copy that down through A35.

    Now your monthly list of dates will create itself accurately.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Automatically creating a series of dates

    If you prefer a consistent formula for all perhaps:

    A5: =IF(ROWS(A$5:A5)>DAY(DATE($B$3,$B$2+1,0)),"",DATE($B$3,$B$2,ROWS(A$5:A5)))
    copied down to A35

    above uses same ranges as outlined in JB's prior post

  4. #4
    Registered User
    Join Date
    02-02-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2016
    Posts
    48

    Re: Automatically creating a series of dates

    Great. That works well. Thank you.

    Another question: if I enter the name of the month e.g. February, is there an easy way of converting this to its numeric equivalent e.g. 2 (without using IFs)?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Automatically creating a series of dates

    (groan)

    You have a working solution and you just have to go and get all humanized on the cell value, huh? Hehe... Your original example is perfect!

    Anyway...using Don's 1-formula approach...in A5:

    =IF(ROWS(A$5:A5) > DAY(EOMONTH(DATEVALUE("1 " & $B$2 & " " & $B$3), 0)), "", DATEVALUE(ROWS($A$5:$A5) & $B$2 & " " & $B$3))
    Last edited by JBeaucaire; 02-11-2010 at 01:46 AM.

  6. #6
    Registered User
    Join Date
    02-02-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2016
    Posts
    48

    Re: Automatically creating a series of dates

    Wonderful! My spreadsheet is now fully humanised - except of course for the formulas themselves!
    Many thanks for your help.
    Martin
    --

+ 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