Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How To Perform and Interpret Regression Analysis in Excel
  • How to do a t-Test in Excel?
  • How to create Checklist in Excel
  • Everything about Charts in Excel
  • How To Remove Duplicates In Excel Column Or Row?

References

  • How to get address of last cell in range in Excel
  • Find closest match in Excel
  • To count total rows in a range in Excel
  • LOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel COLUMN Function

Data Validations

  • Excel Data validation specific characters only
  • Prevent invalid data entering in specific cells
  • Excel Data validation must begin with
  • Excel Data validation require unique number
  • Excel Data validation whole percentage only

How to determine year is a leap year in Excel

by

If you want to test whether the year of a certain date is a leap year, you can use a formula that uses the MONTH, YEAR, and DATE functions.

Formula

=MONTH(DATE(YEAR(date),2,29))=2

Explanation

In the example shown, the formula in cell C5 is:

=MONTH(DATE(YEAR(B5),2,29))=2

How the formula works

The core of this formula is the DATE function, which will automatically adjust to month and year values that are out of range. In the formula, year is passed into date unchanged, along with 2 for month (February) and 29 for the day. In leap years, February has 29 days, so the DATE function will simply return the date February 29 of the year.

Worked Example:   Convert Unix time stamp to Excel date

In non-leap years however, DATE will return the date March 1 of the year, because there is no 29th day and DATE simply rolls the date forward into the next month.

Worked Example:   Excel Data validation date in specific year

Finally, MONTH simply extracts the month from the result provided by DATE, which is compared to 2 using the equal sign.

If month is 2, the formula returns TRUE. If not, the month must be 3 and the formula returns FALSE.

Just want to test a year?

If you just want to check if a year (i.e. 2015, 2016, etc.), modify the formula as follows:

=MONTH(DATE(year,2,29))=2

A more literal solution

If the formula above seems to “clever” and you want a more literal solution, you can test if a year contains 366 days instead with this formula:

=DATE(YEAR(date)+1,1,1)-DATE(YEAR(date),1,1)

This formula generates two dates, then subtracts January 1st of the given year from January 1st of the next year.

Worked Example:   Excel Date & Time Functions Example

Post navigation

Previous Post:

Series of dates by day

Next Post:

How to calculate working days left in month in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to use Excel AND Function
  • How to use Excel XOR Function
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • IFNA function: Description, Usage, Syntax, Examples and Explanation
  • Check multiple cells are equal in Excel

Date Time

  • Series of dates by day
  • DAYS function: Description, Usage, Syntax, Examples and Explanation
  • Count times in a specific range in Excel
  • Display the current date in Excel
  • Calculate date overlap in days in Excel

Grouping

  • Group arbitrary text values in Excel
  • Group times into 3 hour buckets in Excel
  • Calculate conditional mode with criteria in Excel
  • Running count group by n size in Excel
  • Map text to numbers in Excel

General

  • How to add sequential row numbers to a set of data in Excel
  • AutoFit Column Width, AutoFit Row Height in Excel
  • Count cells that do not contain errors in Excel
  • Transpose: Switch ‘Rows to Columns’ or ‘Columns to Rows’ in Excel
  • Basic numeric sort formula in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning