+ Reply to Thread
Results 1 to 3 of 3

Adding a number of years to one referenced year

  1. #1
    Registered User
    Join Date
    06-20-2011
    Location
    Reston, VA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Adding a number of years to one referenced year

    Hello daffodill11 and FDibbins -

    Thanks a million to you both. The formula works great on its own. Now I'm trying to use it in a multiple IF statement formula but the results are mixed.

    The objective of my IF statement is to test if the year in cell O1 (i.e., 12/31/2014) is greater than the year in cell F7 (12/31/13) + G7,12,31 (12/31/2018) and - if true report 0 else go to the next IF statement which is: if year in cell P1 (i.e., 12/31/2015) is greater the year in cell F7+G7 (12/31/2018), then report 0, else perform the VLookup function.

    Please refer to the attached excel file to review a sample worksheet.

    Beginning in Cell O6 I entered this formula =IF(YEAR(O$1)>DATE(YEAR($F7)+$G7,12,31),0,1) and copied it through Cell Y6. For Cells O6 thru S6 (years 2014 thru 2018) I expected to receive a 1 (one) and in years 2019 through 2024 I expected to receive a 0 (zero). Instead I received a 1 in all years. What am I missing?

    In Cell O7 I've entered the following IF statement: =IF(YEAR(O$1)>=DATE(YEAR($F7)+$G7,12,31),0,$N7)*VLOOKUP($G7,Rampup,ROUNDUP((O$1-$F7)/365,0)+1,FALSE))
    and I copied it through to Cell Y7 and on the attached Excel file you will see some mixed results.

    In Cells O8 thru Y8, I've entered the correct values, which are manually calculated.

    Thank you for any help you can provide.


    INITIAL POST
    I'm trying to develop a formula that will add a quantity of years to a referenced year. For example

    I am showing the year 2015 in cell A1 and even though only the year shows it is formatted 1/1/2015.

    In cell B1 I have 5 as the number of years I want to add to cell A1.

    When I use the formula below the answer I receive is 1905 instead of 2020.

    =Year(A1)+B1 = 1905

    The formula seems to be recognizing 2015 (cell A1) as being year 1900. What am I doing wrong?
    Attached Files Attached Files
    Last edited by SPRoyLLC; 10-11-2013 at 01:48 PM. Reason: Additional text and attachment

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Adding a number of years to one referenced year

    Adding integers to a date is just adding days.

    Instead, use date(year(a1)+b1,1,1)

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Adding a number of years to one referenced year

    1 thing to remember about how excel handles dates, is that a date is just a 5-digit number representing how many days have passes since 1/1/1900

    So when you say that =Year(A1)+B1 = 1905, that tells me that excel is working out what the year is 2015 days after 1/1/1900, which is a little over 5 years (2015/365). adding 5 (days) to that is not going to change the year, so daffodil's suggestion should give you what you need
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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] Adding number of years selected from a ComboBox to the storage date
    By Help_Required in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2012, 06:41 AM
  2. Replies: 4
    Last Post: 06-23-2011, 11:45 AM
  3. which year one variable is 1 between two years
    By silviario in forum Excel General
    Replies: 2
    Last Post: 06-15-2011, 06:59 AM
  4. Replies: 3
    Last Post: 12-30-2010, 07:24 AM
  5. Replies: 8
    Last Post: 04-04-2009, 03:55 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