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])

ArgumentWhat it is
start_dateThe start date.
end_dateThe end date.
basisoptional0 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.

Advertising
Loading ad...

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.

Step 1/3

In C2, calculate each employee’s years of service as of the cutoff date in I1.

C2
ABCDEFGHIJ
1EmployeeHiredYearsLast payment (text)Last paymentISO weekCutoff12/31/2025
2Ana03/15/20192025-11-28
3Beto07/01/20222025-12-05
4Carla01/20/20152025-12-12
5Dani10/07/20242025-12-19
6Elena12/31/20202025-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".