sequential date related question

  • Thread starter Thread starter Webem0ch
  • Start date Start date
W

Webem0ch

Hi - If for example within cell A3 the date of 09/03/2001 was entered
would it be possible in the cell beneath it, A4, to write code tha
would break the date down into parts (e.g., Month, Date and Year) an
to modify these parts individually?

Therefore within cell A4 the code would suggest that it equaled A3 bu
that it would have the potentail to modify its parts (e.g., Month, Dat
and Year) and not as a whole (e.g., A3+365)

Thus what I would like to place in cell A4 is code that would b
somehow similar to the following
=IF(MONTH(A3)<>12,DATE(YEAR(A3),MONTH(A3)+1,1),DATE(YEAR(A3)+1,1,1))

The result/formula I am after is one that will allow for only the yea
to change and not the month or day.

Advance thanks!

Michae
 
Excel is smarter than you think!

This:
=IF(MONTH(A3)<>12,DATE(YEAR(A3),MONTH(A3)+1,1),DATE(YEAR(A3)+1,1,1))
is the same as:
=date(year(a3),month(a3)+1,1)

Excel knows how to wrap around to the next month or year. (Just like you'd
hope!).

And what's even neater, excel can go backwards:

=date(year(a3),month(a3),0)
(the zeroeth day of one month is the last day of the previous month)

So I think you want:

=date(year(a3)+1,month(a3),day(a3))

It'll work for all except Feb 29. It'll return March 1st of the next year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top