PDA

View Full Version : date display



av8tordude
01-12-2013, 02:58 AM
I have this code that looks at the date in the previous row and displays the following date.

i.e. if the previous row date is 4/12/13 then the date would be 4/13/13.

i.e. if the previous row's date is 04/12/13 then the date would be 04/13/13.

I would like to display the current date, starting from the previous row's date, but limit the displayed date to a maximum date of 12/31 of the current year.

i.e. if the previous row's date is 04/12/13 but today's date is 10/1/2013, it should show 10/01/2013. But if today's date happens to be 01/01/2014, display 12/31/2013, since this is the last date in 2013.

GarysStudent
01-12-2013, 11:15 AM
Without VBA, if A1 contains the previous row's date, then in A2:

=IF(YEAR(A1)=YEAR(TODAY()),TODAY(),DATE(YEAR(A1),12,31))