What YEAR does
YEAR returns the year of a date as a whole number. If A2 holds Mar 15, 2026, =YEAR(A2) gives 2026. The result is a plain number from 1900 to 9999, so you can total by it or hand it to DATE to build another date.
A column of dates becomes something you can group by once the year is in a column of its own: SUMIF and COUNTIF can then total or count each year. YEAR also helps build dates from other dates, as in =DATE(YEAR(A2),12,31), the last day of A2’s year.
Syntax
serial_numberRequired- The date to take the year from, such as a sale date in
A2. Text that Excel can't read as a date gives#VALUE!.
Example: total the sales of each year
A sales log spans the turn of the year. The formula in C2 is filled down to C6, and SUMIF adds up one year below the table.
Read it as: the year of the date in A2. Filled down, each row reads its own date, and the year column is what SUMIF tests.
Example: a fiscal year that starts in July
This company’s fiscal year runs from Jul 1 to Jun 30 and takes the number of the calendar year it ends in. Adding the test (MONTH(A2)>=7) adds 1 for dates from July on, because TRUE counts as 1 in a sum.
For a fiscal year that starts in another month, change the 7 to that month’s number.
Common mistakes
- The result shows as 18 Jul 1905. The cell has a date format, and 2026 read as a date is Jul 18, 1905. Format the cell as General or Number.
=YEAR(B2)on a cell that already holds a year, such as 2026, gives 1905 for the same reason: YEAR reads 2026 as a day count. Use the number as it is.- An empty cell gives 1900, because Excel reads it as 0, which falls in January 1900. Skip the blanks with
=IF(A2="","",YEAR(A2)). =YEAR(C2)-YEAR(B2)for an age or a length of service adds a year on Jan 1 instead of on the anniversary. DATEDIF counts complete years:=DATEDIF(B2,C2,"y").
Frequently asked questions
How do I get the year from a date in Excel?
Use =YEAR(A2) for the year as a number, such as 2026. For the year as text, for example to join it to other words, use =TEXT(A2,"yyyy").
Why does YEAR return a date like 1905?
The cell is formatted as a date, so the year 2026 shows as Jul 18, 1905, day 2026 of Excel’s calendar. Format the cell as General or Number.
How do I sum by year in Excel?
Put the year in a column with YEAR and total it with SUMIF, as in the example above. Without a helper column, SUMIFS can test the dates directly: =SUMIFS(B2:B100,A2:A100,">="&DATE(2026,1,1),A2:A100,"<="&DATE(2026,12,31)) adds the amounts dated in 2026.
How do I count the dates in one year?
Test the year of every date inside SUMPRODUCT: =SUMPRODUCT(--(YEAR(A2:A100)=2026)) counts the dates in A2:A100 that fall in 2026.
How do I get the current year in Excel?
Combine YEAR with TODAY: =YEAR(TODAY()) gives this year and moves on by itself on Jan 1.