PDA

View Full Version : Solved: Help Date's



CCkfm2000
07-04-2011, 08:43 AM
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

Bob Phillips
07-04-2011, 11:32 AM
Try

=IF(MONTH(A2)<>MONTH(A2+1),DATE(YEAR(A2)-1,MONTH(A2+1),1),A2-1)

CCkfm2000
07-05-2011, 02:29 AM
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

Bob Phillips
07-05-2011, 02:42 AM
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))

CCkfm2000
07-06-2011, 09:07 AM
Thanks thats great