+ Reply to Thread
Results 1 to 5 of 5

Subtract 1 year from todays date

  1. #1
    Nigel
    Guest

    Subtract 1 year from todays date

    I have looked and I know it must be eady but I want to subtract 1 year from
    todays date in code, so I tried date-1 year but to no avail, I can use
    date-365 but I would like it to automatically take into account leap years

    Thanks

  2. #2
    new.microsoft.com
    Guest

    Re: Subtract 1 year from todays date

    This formular in code may work

    1_yr_before = DateSerial(Year(Now()) - 1, Month(Now()), Day(Now()))

    yc
    "Nigel" <nigelben@belmontpines.com> wrote in message
    news:AA424EE1-C94C-4601-A8C7-6DAA69320AAB@microsoft.com...
    >I have looked and I know it must be eady but I want to subtract 1 year from
    > todays date in code, so I tried date-1 year but to no avail, I can use
    > date-365 but I would like it to automatically take into account leap years
    >
    > Thanks




  3. #3
    bpeltzer
    Guest

    RE: Subtract 1 year from todays date

    =date(year(date())-1,month(date()),day(date())) will take today's month/day
    and the prior year. I'm not sure what you'd get on Feb 29 ;-).

    "Nigel" wrote:

    > I have looked and I know it must be eady but I want to subtract 1 year from
    > todays date in code, so I tried date-1 year but to no avail, I can use
    > date-365 but I would like it to automatically take into account leap years
    >
    > Thanks


  4. #4
    voodooJoe
    Guest

    Re: Subtract 1 year from todays date

    using a formula: =EDATE(TODAY(),-12)
    using VBA: dateadd("yyyy",-1,date)

    cheers - voodooJoe

    "Nigel" <nigelben@belmontpines.com> wrote in message
    news:AA424EE1-C94C-4601-A8C7-6DAA69320AAB@microsoft.com...
    >I have looked and I know it must be eady but I want to subtract 1 year from
    > todays date in code, so I tried date-1 year but to no avail, I can use
    > date-365 but I would like it to automatically take into account leap years
    >
    > Thanks




  5. #5
    Registered User
    Join Date
    10-03-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Subtract 1 year from todays date

    =(YEAR(TODAY()))-1

    Tested & Working!

    I think is the easiest way to go about it. Make sure the cell is formatted for number & NOT date

+ 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