Consulting

Results 1 to 5 of 5

Thread: Solved: Help Date's

  1. #1
    VBAX Tutor CCkfm2000's Avatar
    Joined
    May 2005
    Posts
    209
    Location

    Solved: Help Date's

    Hello Excel Guru's


    In cell C7 we have a date 31-Mar-2012 I need a formula to check if the date is the end of month and take a year off but add a day on so it should day 01-Apr-2011


    If any other date in cell C7 e.g 28-Mar-2011 I need a formula to take a year off and add a day on so it should day 27-Mar-2011


    Thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    =IF(MONTH(A2)<>MONTH(A2+1),DATE(YEAR(A2)-1,MONTH(A2+1),1),A2-1)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor CCkfm2000's Avatar
    Joined
    May 2005
    Posts
    209
    Location
    Thanks xld, the first part work.


    sorry made a mistake with the 2nd part

    If any other date in cell C7 e.g 28-Mar-2011 I need a formula to take a year off and add a day on so it should day 27-Mar-2010

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Then that would be

    =IF(MONTH(A2)<>MONTH(A2+1),DATE(YEAR(A2)-1,MONTH(A2+1),1),DATE(YEAR(A2)-1,MONTH(A2),DAY(A2)-1))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Tutor CCkfm2000's Avatar
    Joined
    May 2005
    Posts
    209
    Location
    Thanks thats great

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •