+ Reply to Thread
Results 1 to 5 of 5

Same year span for each name

  1. #1
    Registered User
    Join Date
    10-01-2009
    Location
    Manassas, VA
    MS-Off Ver
    Excel 2007
    Posts
    86

    Same year span for each name

    In the data set below, I got the oldest year and the most recent then force each unique Planname to have each of the year in between.

    With the example below, the year range is betwee 2001 - 2009.
    Generic 1 has everything, but Fake 2 is missing 2009 and Whatever is 2003 and 2009

    My goal is to identify the missing year for each name and insert it in. Would like to enter a 0 value for score and make sure the Planname is fill out with the right name.

    I have attempted by using a while loop and a for loop, but unsuccessful.

    Your help is greatly appreciated.

    Planname FY Score
    Generic 1 2001 -6.36
    Generic 1 2002 -9.29
    Generic 1 2003 16.48
    Generic 1 2004 10.06
    Generic 1 2005 10.98
    Generic 1 2006 8.37
    Generic 1 2007 17.92
    Generic 1 2008 -15.21
    Generic 1 2009 -10.03
    Fake 2 2001 -6.05
    Fake 2 2002 -7.81
    Fake 2 2003 15.98
    Fake 2 2004 10.71
    Fake 2 2005 11.26
    Fake 2 2006 8.82
    Fake 2 2007 17.46
    Fake 2 2008 12
    Whatever 2001 -6.05
    Whatever 2002 -7.81
    Whatever 2004 10.71
    Whatever 2005 11.26
    Whatever 2006 8.82
    Whatever 2007 17.46
    Whatever 2008 12

    Final result
    Planname FY Score
    Generic 1 2001 -6.36
    Generic 1 2002 -9.29
    Generic 1 2003 16.48
    Generic 1 2004 10.06
    Generic 1 2005 10.98
    Generic 1 2006 8.37
    Generic 1 2007 17.92
    Generic 1 2008 -15.21
    Generic 1 2009 -10.03
    Fake 2 2001 -6.05
    Fake 2 200 -7. 81
    Fake 2 2003 15.98
    Fake 2 2004 10.71
    Fake 2 2005 11.26
    Fake 2 2006 8.82
    Fake 2 2007 17.46
    Fake 2 2008 12
    Fake 2 2009 0
    Whatever 2001 -6.05
    Whatever 2002 -7.81
    Whatever 2003 0
    Whatever 2004 10.71
    Whatever 2005 11.26
    Whatever 2006 8.82
    Whatever 2007 17.46
    Whatever 2008 12
    Whatever 2009 0
    Attached Files Attached Files
    Last edited by NTB; 11-27-2011 at 10:42 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: Same year span for each name

    Try this:
    Please Login or Register  to view this content.
    _________________
    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
    Registered User
    Join Date
    10-01-2009
    Location
    Manassas, VA
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Same year span for each name

    Thank you for helping, I plugged the code in and it didn't really work the way we want it to.
    Attached Files Attached Files

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

    Re: Same year span for each name

    This version will create a new set of data off to the right.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-01-2009
    Location
    Manassas, VA
    MS-Off Ver
    Excel 2007
    Posts
    86

    Re: Same year span for each name

    Thank you so much for your help once again. Your code works wonderfully, though it has its draw back as my actual dataset is much wider (more columns) than the 3 existing on my original post. It was my fault for not posting or explaining thoroughly.

    However, I used your idea of working things backward and now I am able to insert the missing years.

    Please Login or Register  to view this content.
    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)

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