Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Zoe Zoe is offline
external usenet poster
 
Posts: 12
Default Formula adding 2 days...

So, here is the formula I'm using. Some cells it's adding 2 or 3 days to the
MONTH and some cells it's not. I don't WANT it to add 2 days. It should just
be adding 5 years and leaving the month and day the same... what is happening
here?

=IF(J5="","",DATE(YEAR(J5)+5,MONTH(J5),DAY(J6)))
  #2   Report Post  
Posted to microsoft.public.excel.misc
Zoe Zoe is offline
external usenet poster
 
Posts: 12
Default Formula adding 2 days...

Never mind!!! I'm ridiculous! I figured it out!!!!

"Zoe" wrote:

So, here is the formula I'm using. Some cells it's adding 2 or 3 days to the
MONTH and some cells it's not. I don't WANT it to add 2 days. It should just
be adding 5 years and leaving the month and day the same... what is happening
here?

=IF(J5="","",DATE(YEAR(J5)+5,MONTH(J5),DAY(J6)))

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Formula adding 2 days...

Not all years have the same number of days:

Leap year = 366 days
Not leap year = 365 days

Not all months have the same number of days:

Jan = 31 days
Feb = 28 or 29 days
June = 30 days

So, when you add years and, depending on what day is in J6, Excel adjusts
the resulting accordingly.

A couple of simple examples:

A1 = 2/29/2008

=DATE(YEAR(A1)+2,MONTHA1),DAY(A1))

That returns the date 3/1/2010

You want to add 2 years to the date but 2010 is not a leap year and Feb 29
2010 is not a valid date so Excel returns the next valid date, 3/1/2010.

A1 = 8/31/2010

=DATE(YEAR(A1),MONTH(A1)+1,DAY(A1))

That returns the date 10/1/2010

You want to add 1 month to the date but Sept only has 30 days and 9/31/2010
is not a valid date so Excel returns the next valid date 10/1/2010.

Consider this formula:

A1 = 1/1/2010

=DATE(YEAR(A1),MONTH(A1),35)

In essence, Excel is "smart" enough to know that January 35th 2010 is really
February 4th 2010.

You might be able to use the EDATE function to get the results you expect.

A1 = 2/29/2008

=EDATE(A1,60) returns 2/28/2013

Format as Date. That will return the date 5 years from the date in A1. (12
months per year * 5 years = 60 months)

=DATE(YEAR(A1)+5,MONTH(A1),DAY(A1)) returns 3/1/2013

--
Biff
Microsoft Excel MVP


"Zoe" wrote in message
...
So, here is the formula I'm using. Some cells it's adding 2 or 3 days to
the
MONTH and some cells it's not. I don't WANT it to add 2 days. It should
just
be adding 5 years and leaving the month and day the same... what is
happening
here?

=IF(J5="","",DATE(YEAR(J5)+5,MONTH(J5),DAY(J6)))



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
Formula for adding days to a date excluding weekends and holidays? Jake via OfficeKB.com Excel Discussion (Misc queries) 3 May 20th 23 07:48 PM
If Formula , Adding Days to a Date Khalid A. Al-Otaibi Excel Discussion (Misc queries) 1 March 27th 10 09:29 AM
formula returns #VALUE! when adding days to a date Mamamoose Excel Discussion (Misc queries) 2 August 15th 08 04:34 PM
Adding Working Days to a Formula jpw1972 Excel Discussion (Misc queries) 1 April 4th 06 09:46 AM
What is the formula for adding a number of days to an existing dat Ivan Excel Worksheet Functions 1 May 4th 05 03:00 AM


All times are GMT +1. The time now is 12:53 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"