Return to List of Excel Functions

YEAR Function Examples – Excel, VBA, & Google Sheets

Download Example Workbook

Download the example workbook

This tutorial demonstrates how to use the YEAR Function in Excel and Google Sheets to return the year from a date.

YEAR Formula Main

 

YEAR Examples

The YEAR Function returns the year of a date:

=YEAR(B4)

YEAR

YEAR and DATE Functions

Using the DATE and YEAR Functions you can build a new date using the same year as the original date:

=DATE(YEAR(B3),5,31)

Year date

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:

=DATE(YEAR(B3),1,1)

First day of the year

YEAR in Google Sheets

The YEAR Function works exactly the same in Google Sheets as in Excel:

YEAR Google Sheet

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.