Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I Add or subtract months or years from a date in Excel

Trying to add and subtract years and ormonths to dates and concidering leap
years.
=IF(IF(D25,B2-365,IF(D2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364)))<NOW(),NOW(),IF(C25,B2-365,IF(C2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364))))
is too cryptic!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default How do I Add or subtract months or years from a date in Excel

Hi Dug,

Seems you're not using real Excel dates. You should, absolutely!
It looks like D2 is your month, C2 is the year and B2 is the day. Adjust if
I'm wrong.
In E2, put: =date(C2,D2,B2)

To add a year:
=Date(year(E2)+1,month(E2),day(E2))

etc

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Dug Rowland" <Dug wrote in message
...
Trying to add and subtract years and ormonths to dates and concidering
leap
years.
=IF(IF(D25,B2-365,IF(D2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364)))<NOW(),NOW(),IF(C25,B2-365,IF(C2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364))))
is too cryptic!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default How do I Add or subtract months or years from a date in Excel

But of course some issues remain; what do you expect the date plus one year
to be if the original date in a leap year is Feb 29?
A resume about dates (and times) in Excel can be found at

http://www.cpearson.com/excel/datetime.htm#SerialDates

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Niek Otten" wrote in message
...
Hi Dug,

Seems you're not using real Excel dates. You should, absolutely!
It looks like D2 is your month, C2 is the year and B2 is the day. Adjust
if I'm wrong.
In E2, put: =date(C2,D2,B2)

To add a year:
=Date(year(E2)+1,month(E2),day(E2))

etc

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Dug Rowland" <Dug wrote in message
...
Trying to add and subtract years and ormonths to dates and concidering
leap
years.
=IF(IF(D25,B2-365,IF(D2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364)))<NOW(),NOW(),IF(C25,B2-365,IF(C2<3,B2-365,IF(C2/4=INT(C2/4),B2-363,B2-364))))
is too cryptic!





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I Subtract 6 months off a date in excel Geoff Excel Discussion (Misc queries) 4 April 3rd 23 12:15 PM
subtract years and months (as in ages) from another age Rumplestiltskin Excel Discussion (Misc queries) 3 February 4th 07 01:05 PM
To create formula to add 3 years and subtract 1 day from a date? rostroncarlyle Excel Worksheet Functions 2 December 8th 05 11:21 PM
How do I subtract a date from a date for a sum of total years? Paige Excel Discussion (Misc queries) 4 October 27th 05 03:10 PM
Excel Adding years or months to a date Joan Excel Discussion (Misc queries) 2 April 25th 05 08:09 PM


All times are GMT +1. The time now is 07:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"