+ Reply to Thread
Results 1 to 6 of 6

How to calculate the years

  1. #1
    Registered User
    Join Date
    07-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2003
    Posts
    8

    How to calculate the years

    I have two columns in Excel, the 1st column is "Date Purchased" (A1) and my 2nd column is "Estimated Year in Service" (A2). On A3 would be the result. see example below.

    1-Jan-2012 + 5 = 1-Jan-2017

    pls help.

    thank you

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

    Re: How to calculate the years

    Hello,

    if A1 has a real date, then you can use this formula to add the number of years defined in A2 with this formula in A3

    =EDATE(A1,A2*12)

    or

    =DATE(YEAR(A1+A2),MONTH(A1),DAY(A1))

    cheers,

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: How to calculate the years

    Quote Originally Posted by teylyn View Post
    =EDATE(A1,A2*12)
    Make sure your excel 2003 have Analysis Toolpak installed already.


    Quote Originally Posted by teylyn View Post
    =DATE(YEAR(A1+A2),MONTH(A1),DAY(A1))
    should be:
    Please Login or Register  to view this content.

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

    Re: How to calculate the years

    bebo, thanks for the corrections. You're right, of course. My mouse is playing up and driving me bonkers, irritating me to the point of neglecting detail. Thanks for picking it up.

  5. #5
    Registered User
    Join Date
    07-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: How to calculate the years

    Thanks guys..it worked!...i made a couple of changes on my table.
    =DATE(YEAR(A1)+B1,MONTH(A1),DAY(A1))

    Now, I have two more concerns.

    1. If A1 and B1 are blank C1 displays "0-Jan-1900". I want to have a blank result in C1..is this possible?
    2. In cell C1, I want to filter only the YEAR (regardless of month/day). On the example below, If i want to filter only 2014 it will display only 3 records.

    11-Dec-2011 2 11-Dec-2013
    10-May-2011 3 10-May-2014
    13-Jan-2012 3 13-Jan-2015
    13-Jan-2012 2 13-Jan-2014
    13-Jan-2012 2 13-Jan-2014

    Please help, thank you.

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

    Re: How to calculate the years

    Hello,

    you can wrap the formula in an IF statement, for example execute it only if the number of values in A1 and B1 is 2:

    =If(count(A1:B1)=2,DATE(YEAR(A1)+B1,MONTH(A1),DAY(A1)),"")

    If you want to filter by year, you have two possibilities:

    Either format the whole column C with custom format

    yyyy

    so only the year shows. Or, if you still want to see the full date in column C, create a helper column in column D with the formula

    =IF(ISNUMBER(C1),YEAR(C1),"")

    copy down, and then filter on the values in that column.

    In later versions of Excel, the filters are more sophisticated and you can select the year right there, even though the column shows the whole date, but with 2003 you need to use one of the workarounds above.

    cheers,

+ 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