Skip to playerSkip to main content
  • 7 weeks ago
Discover the formula for leap year in Excel.
This video aspires to answer these questions.
- What is the formula to calculate leap year?
- What is the leap year problem in Excel?
- Is 1900 a leap year in Excel?
- How do I calculate leap year in Excel VBA?
- Leap Year in Excel
- Identify leap year in Excel

Here are the methods outlined in the video.

Method 1
=IF(MOD(YEAR(A3),4)=0,IF(MOD(YEAR(A3),100)=0,IF(MOD(YEAR(A3),400)=0,"Leap Year",""),"Leap Year"),"")

Lets break down this formula.

1) YEAR(A3) extracts the year from the date in cell A3.
2) MOD(YEAR(A3),4) calculates the remainder when the year is divided by 4. If this result is equal to 0, it means the year is divisible by 4.
3) IF(MOD(YEAR(A3),4)=0, ...) is the first level of the IF function. It checks if the year is divisible by 4. If it is, it proceeds to the next level.
4) MOD(YEAR(A3),100) calculates the remainder when the year is divided by 100. This is used to identify exceptions to the leap year rule. If this result is equal to 0, it means the year is divisible by 100.
5) IF(MOD(YEAR(A3),100)=0, ...) is the second level of the IF function. It checks if the year is divisible by 100. If it is, it proceeds to the next level.
6) MOD(YEAR(A3),400) calculates the remainder when the year is divided by 400. This is the final level of the IF function. If this result is equal to 0, it means the year is divisible by 400 and, in this case, is considered a leap year.
7) If the year is divisible by 400 (MOD(YEAR(A3),400)=0), the formula returns "Leap Year."
8) If the year is not divisible by 400 but is divisible by 100 (MOD(YEAR(A3),100)=0), the formula returns an empty string (""). This is because years divisible by 100 are not leap years unless they are also divisible by 400.
9) If the year is divisible by 4 but not by 100 (MOD(YEAR(A3),4)=0 and MOD(YEAR(A3),100)0), the formula returns "Leap Year."
10) If the year is not divisible by 4 (MOD(YEAR(A3),4)0), the formula returns an empty string (""). This is because non-multiple-of-4 years are not leap years.

So, the formula checks for leap years by considering the divisibility of the year by 4, 100, and 400, following the rules of the Gregorian calendar. If it meets these conditions, it returns "Leap Year"; otherwise, it returns an empty string.



Method 2
=IF(DAY(DATE(YEAR(A3),3,0))=29,"Leap Year","")

Lets break down this formula.

1) YEAR(A3): This function extracts the year from the date in cell A3.
2) DATE(YEAR(A3), 3, 0): This function creates a date using the year from A3, 3 as the month (March), and 0 as the day. However, when you provide 0 as the day, Excel automatically rolls back to the last day of the previous month. So, if A3 contains the year 2023, this part of the formula creates the date "February 28, 2023."
3) DAY(DATE(YEAR(A3),3,0)): This part of the formula extracts the day component from the date created in the previous step. In this case, it extracts the value 28.
Transcript
00:00There are essentially three ways to determine if a date is a leap year.
00:03For method 1, if a year is divisible by 4, 100, and 400, it is a leap year,
00:09and if the year is divisible by 4 but not 100, it is still a leap year.
00:14For method 2, it pretends that it is March 0 of the year, which is effectively 29th February,
00:20which means it is a leap year. Otherwise, it is not a leap year.
00:24For method 3, it pretends that it is February 29 of the year,
00:28and the formula effectively returns 2, which means it is a leap year. Otherwise, it is not a leap year.
Comments

Recommended