### The YEAR Function Overview

The YEAR function displays the year portion of a date that has been entered into the function.

In the example below we will find the number of years between two dates.

The syntax for the YEAR function is:

**= YEAR ( Serial_number )**

**Serial_number** - the serial date or the cell reference to a date to be used in the calculation.

### Example: Subtract Dates with the YEAR Function

For help with this formula see the image above.

In this example we want to find out the number of years between two dates. Our final formula will look like this:

= YEAR ( D1 ) - YEAR ( D2 )

To enter the formula into Excel we have two options:

- Type the above formula in to cell E1 with the two dates to be subtracted in cells D1 and D2
- Use the YEAR function dialog box to enter the formula into cell E1

This example will use the dialog box method to enter the formula. Since the formula involves subtracting two dates, we will be entering the YEAR function twice using the dialog box.

- Enter the following dates into the appropriate cells
**D1: 7/25/2009**

D2: 5/16/1962 - Click on cell E1 - the location where the results will be displayed.

- Click on the
*Formulas*tab.

- Choose
**Date & Time**from the ribbon to open the function drop down list.

- Click on
*YEAR*in the list to bring up the function's dialog box.

- Click on cell D1 to enter the cell reference of the first date into the dialog box.

- Click OK.

- In the formula bar you should see the first function:
**= YEAR ( D1 )**.

- Click in the formula bar after the first function.

- Type a minus sign (
**-**) into the formula bar after the first function since we want to subtract the two dates.

- Choose
**Date & Time**from the ribbon to open the function drop down list again.

- Click on
*YEAR*in the list to bring up the function's dialog box a second time.

- Click on cell D2 to enter the cell reference for the second date.

- Click OK.

- The number
**47**should appear in cell E1 as there are 47 years between 1962 and 2009.

- When you click on cell E1 the complete function
**= YEAR ( D1 ) - YEAR ( D2 )**appears in the formula bar above the worksheet.

**Related Articles**

- Subtract Dates in Excel with the DAY Function
- Subtract Dates in Excel with the MONTH Function
- Excel DATEDIF Function