YEAR Function Examples – Excel, VBA, & Google Sheets

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

YEAR Function Overview

The YEAR Function Returns the year of a date.

To use the YEAR Excel Worksheet Function, Select cell and Type:

year formula syntax

(Notice how the formula input appear)

YEAR Function syntax and Inputs:

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).

 

AutoMacro - VBA Code Generator

YEAR Examples

The YEAR Function returns the year of a date:

YEAR

YEAR and MONTH Functions

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

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:

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.

Return to the List of all Functions in Excel

 

Excel Practice Worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!