The YEAR function extracts the year from a time value and returns it as a four-digit number. If you work with time but only care about the years, this function lets you eliminate everything else.
ℹ️ Remember that dates are just saved as numbers by your spreadsheet with date formatting applied.
Contents
Purpose
The YEAR function returns the year’s value from any given unit of time.
Syntax
=YEAR(time)
Common Errors
#VALUE! – An invalid date was passed to the function, such as "1/32/2022"
. The month of January does not have 32 days.
#ERROR! – Formula parse error. The input to the function could not be used, such as a date with too many slashes. – 1//21/2222
.
#NUM! – Result was not a number. The number is too large to resolve to a date. – (548748511)
.
If the output is an unexpected format such as 12:00 AM. – This means the formatting is incorrect, not the underlying number. Change the formatting to Number.
Examples
Example 1 – Plain and Simple
First, here are a few simple examples.
Formula | Description | Result |
=YEAR("1/2016") | Extract the year value from 1/2016. | 2016 |
=YEAR("1/31/2016") | Extract the year value from 1/31/2016. | 2016 |
=YEAR("2016") | Extract the year value from 2016 | 1905 |
Tip: Notice that the YEAR function can’t determine that the number 2016 refers to a year when typed alone in a cell. See how dates and times work to make a little sense of this.
Example 2 – Separating the Values of a Date and Time
Different date values examined using various functions.
Time value | Tickmark | YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | Formatted as number |
---|---|---|---|---|---|---|---|---|
7/30/2016 | 1 | 2016 | 7 | 30 | 0 | 0 | 0 | 42,581.00 |
7-30-2016 | 2 | 2016 | 7 | 30 | 0 | 0 | 0 | 42,581.00 |
6/1/2017 2:32 PM | 3 | 2017 | 6 | 1 | 14 | 32 | 0 | 42,887.61 |
July 31, 2016 | 4 | 2016 | 7 | 31 | 0 | 0 | 0 | 42,582.00 |
12:30 PM | 5 | 1899 | 12 | 30 | 12 | 30 | 0 | 0.52 |
4/11/2017 11:24:14 | 6 | 2017 | 4 | 11 | 11 | 24 | 14 | 42,836.48 |
4/11/2017 | 7 | 2017 | 4 | 11 | 0 | 0 | 0 | 42,836.00 |
8 | 1899 | 12 | 30 | 0 | 0 | 0 | ||
1 | 9 | 1899 | 12 | 31 | 0 | 0 | 0 | 1.00 |
0.25 | 10 | 1899 | 12 | 30 | 6 | 0 | 0 | 0.25 |
43000 | 11 | 2017 | 9 | 22 | 0 | 0 | 0 | 43,000.00 |
- 1 A random date typed in using slashes.
- 2 A random date typed in using dashes. Note that it is processed the same way as the date with slashes.
- 3 Typed a random date in and added a time. Now the function extracts the hours and minutes.
- 4 Typed in a date but spelled out. Writing out the date also works, but it won’t work if you write the day as “31st” instead of 31.
- 5 If you only type in a time, the “zero” date is 12/30/1899.
- 6 Entered with the NOW function. The output will constantly change in the linked Google Sheet.
- 7 Entered with the TODAY function. The output will change daily in the linked Google Sheet.
- 8 A blank cell is December 30, 1899. Similar to tickmark 5.
- 9 Typing a 1 will increment the value in number 10 above by 1 day. In other words, “1=12/31/1899”. It is just a matter of how it is displayed, which can be controlled by going to the Format menu and choosing Number.
- 10 Just a decimal with no whole number increments the value by hours, minutes, and seconds instead of days.
- 11 To get near the current date, you need to start with 43,000 days away from 12/30/1899.
Example 3 – Returning the End of the Year
You can use the YEAR function to change any date to the last day of that year. For example, let’s turn 10/10/2025
into 12/31/2025
.
Formula | Description | Result |
=YEAR("10/10/2025") | Change a date to the end of the year. | 12/31/2025 |
Live Examples in Sheets
Go to this spreadsheet for examples of the time functions you can study and use anywhere you want.