The YEAR function in Google Sheets is a simple yet powerful tool that extracts the year component from a given date. Whether you’re organizing data or performing calculations involving different years, this function streamlines the process by allowing you to easily retrieve the year in a numerically viable format.
Syntax
YEAR(date)
- date: This is the date from which you want to extract the year. It can be a cell reference containing a date, a date value, or a function returning a date.
Example #1
YEAR("2023-10-05")
This function call will extract the year from the date provided, which is 2023 in this case.
Example #2
YEAR(A1)
Assuming cell A1 contains the date 2022-08-15, this function will return 2022 as the extracted year.
Example #3
YEAR(TODAY())
This function will return the current year based on today’s date, which might be 2023 depending on when the function is executed.
Error handling
- VALUE!: This error occurs if the provided date is not recognized as a valid date format.
- NUM!: This error appears if the input is not a number or a date serial number in Excel’s date system.
- REF!: This can occur if the cell reference you are using doesn’t exist or is invalid.