Would also be helpful if there were similar formulae that would provide the
ability to either add 1 day or add 1 year to the current date......Of course
it needs to take into account leap years and other problems.....can anyone
help
To return the Current Date + 1 Day use
=Today() + 1
To return the Current Date + 1 Year
=DATE(YEAR(TODAY()) +1,MONTH(TODAY()),DAY(TODAY()))
You mention that it has to account for leap years. What do you mean by that? If you replace the +1 with +3 in the formula above to add three years to today (and thus cross over 2008 which is the next leap year) the date returned is 7/27/09. Is this not the answer you are looking for?
Originally Posted by scott56hannah
---------------------------------------------------
ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
To insert code into the VBE (Visual Basic Editor)
- Copy the code.
- Open workbook to paste code into.
- Right click any worksheet tab, select View Code
- VBE (Visual Basic Editor) opens to that sheets object
- You may change to another sheets object or the This Workbook object by double clicking it in the Project window
- In the blank space below the word "General" paste the copied code.
The formula:
=TODAY()+1
will add 1 day to today's date.
You could also use:
=DATE(YEAR(TODAY())+3,MONTH(TODAY())+4,DAY(TODAY())+2)
This will add 3 years, 4 months and 2 days to today's date.
HTH,
Elkar
"scott56hannah" wrote:
> Would also be helpful if there were similar formulae that would provide the
> ability to either add 1 day or add 1 year to the current date......Of course
> it needs to take into account leap years and other problems.....can anyone
> help
Scott56hannah:
Leap Years should not be a problem that I can see, and you should specify in more detail when you say, “other problems”. However, this formula will determine if it is a leap year or not.
=IF(MOD(YEAR(A1),4)=0,"YES","NO")
Since Feb. 29th can’t exist in Feb. unless it is a Leap Year, Excel will automatically accommodate by your adding 1 day to make it either the 29th or the 01st of Mar. Use this formula.
=DATE(YEAR(A1)+1,MONTH(A1),DAY(A1)+1)
Matt
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks