In this Article
This tutorial demonstrates how to use the Excel YEAR Function in Excel to return the year from a date.
YEAR Function Overview
The YEAR Function Returns the year of a date.
To use the YEAR Excel Worksheet Function, Select cell and Type:
(Notice how the formula input appear)
YEAR Function syntax and Inputs:
1 |
=YEAR(serial_number) |
serial_number – The date in Excel serial number format or entered as a date with quotations (“s) surround the date. Example: You can not enter 11/12/2015 directly into the cell. Instead you need to enter “11/12/2015” or you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).
YEAR Examples
The YEAR Function returns the year of a date:
1 |
=YEAR(B4) |
YEAR and MONTH Functions
Using the DATE and YEAR Functions you can build a new date using the same year as the original date:
1 |
=DATE(YEAR(B3),5,31) |
First Day of Year
Using the same logic as the previous example, we can use the YEAR and DATE functions to reference the first day of the year:
1 |
=DATE(YEAR(B3),1,1) |
YEAR in Google Sheets
The YEAR Function works exactly the same in Google Sheets as in Excel:
YEAR Examples in VBA
You can also use the YEAR function in VBA. Type:
application.worksheetfunction.year(serial_number)
For the function arguments (serial_number, etc.), you can either enter them directly into the function, or define variables to use instead.
Return to the List of all Functions in Excel