Excel YEARFRAC function
Returns the years between two dates with decimals: 2.5 is two and a half years. In Spanish Excel it is called FRAC.AÑO.
Syntax
English Excel
=YEARFRAC(start_date, end_date, [basis])
Spanish Excel (Mexico)
=FRAC.AÑO(fecha_inicial, fecha_final, [base])
Spanish Excel (Spain, Latin America)
=FRAC.AÑO(fecha_inicial; fecha_final; [base])
| Argument | What it is |
|---|---|
| start_date | The start date. |
| end_date | The end date. |
| basisoptional | 0 or omitted 30/360, 1 actual days, 2 actual/360, 3 actual/365, 4 European 30/360. |
Example
YEARFRAC(start, end) gives the years between two dates with decimals: 2.5 is two and a half years. DATEVALUE turns a date stored as text (like "2024-03-15", typical of a CSV) into a real date. ISOWEEKNUM gives the ISO week, used in logistics and payroll.
=YEARFRAC(B2,$I$1)
Common mistake
For exact seniority or age use basis 1. For whole years, INT(YEARFRAC(…)) or DATEDIF with "Y".
About Ads
This site uses Google AdSense to display ads. These ads help us keep WebHerramientas completely free. Ads are managed by Google and meet strict security and privacy standards.
Ads help us keep WebHerramientas free for everyone
Practice YEARFRAC
Type the formula in the sheet and check it instantly. Spanish or English function names both work. See all lessons
Seniority, text dates and ISO weeks
YEARFRAC(start, end) gives the years between two dates with decimals: 2.5 is two and a half years. DATEVALUE turns a date stored as text (like "2024-03-15", typical of a CSV) into a real date. ISOWEEKNUM gives the ISO week, used in logistics and payroll.
In C2, calculate each employee’s years of service as of the cutoff date in I1.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Employee | Hired | Years | Last payment (text) | Last payment | ISO week | Cutoff | 12/31/2025 | ||
| 2 | Ana | 03/15/2019 | 2025-11-28 | |||||||
| 3 | Beto | 07/01/2022 | 2025-12-05 | |||||||
| 4 | Carla | 01/20/2015 | 2025-12-12 | |||||||
| 5 | Dani | 10/07/2024 | 2025-12-19 | |||||||
| 6 | Elena | 12/31/2020 | 2025-12-26 | |||||||
| 7 |
Tip: while typing, click a cell or drag across several to insert their reference. F4 anchors the reference with $.
Frequently asked questions
- What is YEARFRAC called in Spanish?
- In Spanish Excel it is FRAC.AÑO. The formula =YEARFRAC(B2,$I$1) is written =FRAC.AÑO(B2;$I$1) (or with commas in Mexico).
- Why does YEARFRAC use semicolons in some Excel versions?
- It depends on regional settings. Where the comma is the decimal mark (Spain, much of South America), Excel separates arguments with semicolons. English Excel and Mexican Spanish Excel use commas.
- What is the most common YEARFRAC mistake?
- For exact seniority or age use basis 1. For whole years, INT(YEARFRAC(…)) or DATEDIF with "Y".