LEAP YEAR

HighlandPiper

New Member
Joined
Apr 28, 2016
Messages
19
Good afternoon all

Should my excel spreadsheet automatically identify 2024 as a leap year? It doesn't!

Let me expand on that. I have a lookup table that will calculate 36 months based on the start date.

Example
Manual input - Start Date: 02/02/2024
Formula - End Date: 02/02/2027

I am also using an online platform and when I enter the start date of 02/02/2024 the result is 03/02/2027
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Yes Excel does know that 2024 is a leap year. What makes you think it doesn't?
 
Upvote 0
To prove that Excel recognizes the Leap Year, enter 2/2/24 in cell A1, then enter this formula in cell B1:
Excel Formula:
=A1+27
You can see that it returns 2/29/24

If you are trying to do date math where you are adding months or years to a date, it will ignore the day part and always return the same day, i.e.
regardless of whether or not there is a leap year, adding exactly 3 years to the date 2/2/24 is 2/2/27.

If you want it to be 2/1/27, you would need to add days, not months or years, i.e.
Excel Formula:
=A1+(365*3)
 
Upvote 0
I would add months, but I would use EDATE to get it:

=EDATE(B1,36)
Scott, that might be what they are using now, and if I understand it correctly, I think that is precisely what they are saying the problem is.
That formula would return 2/2/2027.

But if I am understanding it correctly, I think they are expecting wanting 2/1/2027 (because this year is a Leap Year, they are wanting one day earlier on the final date).
If their intention is to return 2/1/2027 and not 2/2/2027, they could not use a method like this that adds months or years, but would rather have to use one that add days, like I showed.

Based on the original question, that is my best guess, but I could be completely wrong, as they have not shown us the formula that they are currently using.
 
Upvote 0
But 365 isn't exactly accurate either. The 2nd example said they got a date of March 2, 2027 which made no sense at all to me.

This might be a little closer though:
=B1+(365.25*3)

If they decided they want 4 years instead of 3, your formula wouldn't give the result I would expect

Book1
ABCD
1Manual input - Start Date2/29/20242/28/20282/29/2028
2Formula - End Date2/28/2027
Sheet1
Cell Formulas
RangeFormula
C1C1=B1+(365*4)
D1D1=B1+(365.25*4)
B2B2=EDATE(B1,36)




EDATE doesn't always return the same day though.

If you do an EDATE on 2/29/24 with 36 month, it doesn't return March 1 which would technically be an equivalent day, It returns 2/28 since it's not a leap year
 
Upvote 0
But 365 isn't exactly accurate either. The 2nd example said they got a date of March 2, 2027 which made no sense at all to me.

This might be a little closer though:
=B1+(365.25*3)
I may have misunderstood what there question/end goal is. Without seeing their formula it is hard to tell.
Upon further review and looking back at the question, it looks like maybe 2/2/2027 is the desired goal, but they are getting 3/2/2027 (I missed that date at first, as being in the US, our date formats are m/d/yyyy, and I was focusing on the second number of 2 instead of the first number of 3).

So I am thinking that you are probably correct, and if 2/2/2027 is actually their goal, your EDATE formula would be my recommendation too.
 
Upvote 0
Hi guys, thank you all for your replies, amazing! I will post my formula, an an extract from the lookup table tomorrow when I get home.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top