+ Reply to Thread
Results 1 to 6 of 6

fill in missing years in a range

  1. #1
    Registered User
    Join Date
    03-04-2010
    Location
    Colorado Springs, US
    MS-Off Ver
    Excel 2003-2007
    Posts
    3

    Smile fill in missing years in a range

    hello! im just new to this forum, hope you guys can help me with this...
    i need to be able to break down the inclusive years in a date range. my data appears as follows:
    A B C D
    dfs 1999 2001
    dfs 1965 1968
    dfs 1988 1988
    xku 1998 2002
    huu 2000 2010
    huu 1985 1989

    i need to make them appear as:

    A B C D
    dfs 1999 1999 2001
    dfs 2000 1999 2001
    dfs 2001 1999 2001

    will appreciate it if u can send in a simple formula or code for visual basic ... thanks
    Last edited by keith_S; 03-06-2010 at 07:59 PM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: fill in missing years in a range

    Hi keith, welcome to the forum.

    Can you explain this a bit more? I don't see how the top leads to the bottom table. What is the logic? Are we looking at rows or columns?

    The forum software is not very good at displaying tables with blanks, so you better attach a workbook with some sample data. You can upload a file by clicking "Go Advanced" below the Quick Reply box and then the paper clip icon.

  3. #3
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: fill in missing years in a range

    < deleted >
    Last edited by quekbc; 03-04-2010 at 09:35 PM. Reason: already addressed by teylyn

  4. #4
    Registered User
    Join Date
    03-04-2010
    Location
    Colorado Springs, US
    MS-Off Ver
    Excel 2003-2007
    Posts
    3

    Talking Re: fill in missing years in a range

    Thank you teylyn!

    I attached a sample as you've suggested..

    The required outcome is a breakdown of the inclusive years of columns D and E on column G

    i.e. E2:F2 = 1991 to 1993 = 1991, 1992, 1993

    where, for every year that is greater than D but less than or equal to E, we insert a new row below the original row.

    All contents of the original row are copied on the inserted rows except for the year which should increment downwards keeping account of the inclusive years on D (start year) and E (end year) in each range.

    I used 'AddRows' to insert and copy but worked with G manually by getting the first year in each range and dragging it down where the value equals E.

    I am working with a large database so I am hoping there is a way to do this programatically..

    Many thanks.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: fill in missing years in a range

    Have a look on Sheet2.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-04-2010
    Location
    Colorado Springs, US
    MS-Off Ver
    Excel 2003-2007
    Posts
    3

    Thumbs up Re: fill in missing years in a range

    Cool! Just as needed! Thank you WHER!

    Quote Originally Posted by WHER View Post
    Have a look on Sheet2.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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