+ Reply to Thread
Results 1 to 7 of 7

adding years and months

  1. #1
    Forum Contributor
    Join Date
    10-24-2006
    Location
    INDIA
    MS-Off Ver
    office 2010
    Posts
    190

    adding years and months

    Hi Team

    I need another help

    In Cell “K2” I have Date(10/01/2001) and “S2” Cell “2.1” (means 2 years 1 month)
    Now want the total in “T2” adding the years and months

    Final output in T2 is = 11/01/2003 ( adding one month + adding 2 years )

    Hope it is clear

    Regards
    Sagar

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: adding years and months

    This should work for the format suggested

    =K2+(DATE(LEFT(S2,FIND(".",S2)-1),RIGHT(S2,LEN(S2)-FIND(".",S2)),))
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Contributor
    Join Date
    10-24-2006
    Location
    INDIA
    MS-Off Ver
    office 2010
    Posts
    190

    Re: adding years and months

    thanks a lot

    Sagar

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: adding years and months

    Maybe easier to use INT:

    =K2+DATE(INT(S2),10*(S2-INT(S2)), )
    Last edited by zbor; 09-25-2009 at 08:59 AM.

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: adding years and months

    =K2+DATE(INT(S2),10*(S2-INT(S2)), )
    Won't that give the same result for 2 yrs 1 month (2.1), and 2yrs 10 months (2.10)?

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: adding years and months

    True, my fault

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: adding years and months

    Quote Originally Posted by sweep View Post
    =K2+(DATE(LEFT(S2,FIND(".",S2)-1),RIGHT(S2,LEN(S2)-FIND(".",S2)),))
    This will always be approximately a month out. If S2 = 2.1 then you're doing this

    =K2+DATE(2,1,0)

    =DATE(2,1,0)

    gives the 31st December, i.e. you are adding 2 years

    Also, the formula will only distinguish between 2.1 and 2.10 if S2 is text-formatted.

    So if S2 is text formatted you can use this formula

    =DATE(YEAR(K2)+INT(S2+0),MONTH(K2)+MID(S2,FIND(".",S2)+1,2),DAY(K2))

    but I'd suggest a numeric format for S2 with 2 years and 1 month shown as 2.01 and 2 years 10 months shown as 2.10 in which case you could use this formula:

    =DATE(YEAR(K2)+INT(S2),MONTH(K2)+MOD(S2,1)*100,DAY(K2))

    or using Analysis ToolPak functions

    =EDATE(K2,ROUND(DOLLARDE(S2,12)*12,0))

+ 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