Returns the number of years between two dates.
YEARS(startdate, enddate, mode)
If mode is 0, YEARS returns the number of whole years between startdate and enddate, day/month to day/month.
If mode is 1, YEARS identifies the year that startdate and enddate each lie in, and returns the difference between those years. In other words it returns YEAR(enddate) - YEAR(startdate)
If startdate is after enddate the result will be negative.
YEARS("2009-04-03", "2011-11-17", 0)
returns 2.
YEARS("2011-02-28", "2012-02-28", 0)
returns 1. 2012 is a leap year, but 28th February to 28th February is classed as a whole year.
YEARS("2012-02-29", "2013-02-28", 0)
returns 0. 2012 is a leap year, but 29th February to 28th February is not classed as a whole year, even though both dates are the last day of February.
YEARS("2009-04-03", "2011-11-17", 1)
returns 2.
YEARS("2009-12-31", "2010-01-01", 1)
returns 1. Even though there is only one day between the dates, they lie in different years.
Here is an application of using a hypothetical employee database. Let's say a company needs to find the number of full years each employee has worked to determine who is eligible for a long-service award, which is given after 10 full years of employment.
Employee Data Table:
Employee ID | Name | Start Date | End Date | Years of Service | Eligible for Award? (Years >= 10) | ||
|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | ||
1 | 101 | John Smith | 3/15/2005 | 8/8/2025 | 20 | Yes | |
2 | 102 | Jane Doe | 6/20/2018 | 8/8/2025 | 7 | No | |
3 | 103 | Peter Jones | 11/1/2010 | 8/8/2025 | 15 | Yes | |
4 | 104 | Mary Williams | 1/10/2024 | 8/8/2025 | 1 | No |
The "Eligible for Award?" column is a result of a conditional check, not a direct calculation from the YEARS function itself. It's a binary outcome (Yes/No) based on whether an employee meets the eligibility criteria for the long-service award.
Here's a breakdown of the results in that column, row by row:
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof