+ Reply to Thread
Results 1 to 4 of 4

Fill table with dates given start and end date

  1. #1
    Registered User
    Join Date
    11-08-2009
    Location
    Southern California
    MS-Off Ver
    Excel 2003
    Posts
    4

    Fill table with dates given start and end date

    Hi,

    Is there a way to automatically fill a column with dates given a start and end date? For example:
    Given fields with
    start date of 11/27/2013 and End date of 12/31/2013

    A table would be created with these dates
    11/27/2013
    11/28/2013
    11/29/2013
    11/30/2013
    12/1/2013
    ---
    --
    12/31/2013

    I know you can start with the earliest date and drag a cell down to the target date, but I'm looking for more automation after a user enters the start and ends dates

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Fill table with dates given start and end date

    One way...

    User entered dates in C1 and D1.

    Enter this formula in A1:

    =IF(COUNT(C1:D1)<2,"",C1)

    Format as Date

    Enter this formula in A2:

    =IF(N(A1),IF(A1+1<=D$1,A1+1,""),"")

    Format as Date

    Copy down to as many cells as you think you may need to capture every date.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    11-08-2009
    Location
    Southern California
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Fill table with dates given start and end date

    Thanks! It basically works, but in the application I am using -- it causes issues with the chart with anything less then 365 days (I copied the formula down 365 rows in the table to account for a user entering dates for a year) It shifts the graph to the left because the x-axis includes empty date fields for any remaining rows.

    I decided to use a vba script instead:

    Sub InsertDates()
    Range("A10:B400").ClearContents
    Dim Rng As Range
    On Error Resume Next
    Set Rng = Range("Table4").SpecialCells(xlCellTypeBlanks)
    On Error GoTo 0
    If Not Rng Is Nothing Then
    Rng.Delete Shift:=xlUp
    End If

    r = 8
    x = 9
    Do While Range("A" & r) < Range("B2")

    Range("A" & x).Value = Range("A" & r) + 1

    r = r + 1
    x = x + 1

    Loop

    End Sub

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Fill table with dates given start and end date

    Good deal. Thanks for the feedback!

+ 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] Fill End Date with Start date of the next Matching Entry
    By Whraith in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-20-2013, 12:06 AM
  2. Fill Range based on Start/End Date
    By Regenbui in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2013, 08:02 AM
  3. Replies: 4
    Last Post: 10-05-2012, 03:06 PM
  4. Pivot Group Dates - how to remove start and end dates from table
    By markoloughlin in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-21-2012, 04:19 AM
  5. Using VBA to fill col with dates based on start and end date
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2011, 11:58 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