Summary
The Excel YEAR function extracts the year from a given date as a four-digit number. This function is useful for converting a date into a year number, which can then be used in various date-related calculations or for categorizing data by year.
Syntax
=YEAR(serial_number)
- serial_number: The date from which you want to extract the year.
Return value
A four-digit number representing the year.
How to use
The YEAR function requires a valid Excel date as input. This date can be a cell reference containing a date, a date returned by another function, or a date typed directly into the function in a recognized Excel date format. The function then returns the year component of that date as a four-digit number.
Examples
Simple YEAR
Basic Year Extraction: To extract the year from a specific date:
=YEAR("2022-07-15")
This formula extracts the year from the given date, July 15, 2022, and returns 2022.
YEAR for Age Calculation
Calculating Age: To calculate a person’s age in years using their birthdate:
=YEAR(TODAY()) - YEAR("2000-05-20")
This formula calculates the age of a person born on May 20, 2000, as of today’s date.
Additional Notes
- The YEAR function will return a #VALUE! error if the input is not a recognized date.
- The function is particularly useful in financial analysis, project planning, and data organization where the year component of a date is a critical factor.