Function: YEARFRAC()
🔍 Purpose:
The YEARFRAC() function calculates the exact difference between two dates in years, including fractions (decimal parts).
It’s extremely useful when you want to know how many full and partial years exist between two dates — for example, employee experience, student course duration, loan age, or age calculation.
🧮 Syntax: =YEARFRAC(start_date, end_date, [basis])
Parameters:
-
start_date → The beginning date.
-
end_date → The ending date.
-
[basis] (optional) → Defines how the year is calculated (days per year basis).
📘 Basis Options Table:
| Basis | Description |
|---|---|
| 0 | US (NASD) 30/360 method (default) |
| 1 | Actual / Actual |
| 2 | Actual / 360 |
| 3 | Actual / 365 |
| 4 | European 30/360 method |
💡 Usually, you can use 1 for real-world accuracy in India, as it counts actual days between two dates.
Example :
| Start Date | End Date | Formula | Result | Explanation |
|---|---|---|---|---|
| 01-Jan-2020 | 01-Jan-2025 | =YEARFRAC(A2,B2) |
5.00 | Exactly 5 years |
| 15-Jul-2019 | 10-Jan-2025 | =YEARFRAC(A3,B3) |
5.49 | 5 years + 6 months approx |
| 10-Jan-2023 | 25-Oct-2025 | =YEARFRAC(A4,B4) |
2.80 | 2 years + 9 months approx |
🧠 How It Works:
Excel counts days between the two dates and divides them by the total days in a year, depending on the selected basis.
This gives you an accurate decimal value of years — ideal for financial and HR calculations.
🧾 Example – Employee Experience
| Employee Name | Joining Date | Today’s Date | Formula | Experience (Years) |
|---|---|---|---|---|
| Priya Das | 10-Jan-2020 | =TODAY() | =YEARFRAC(B2,C2) |
5.79 |
| Arjun Sen | 5-Mar-2022 | =TODAY() | =YEARFRAC(B3,C3) |
3.64 |
✅ HR can use this to display exact experience up to months or even days.
🎯 5 Real-Life Project Scenarios (All Different)
🏫 Project 1: Student Course Duration (Education Scenario)
Objective:
Calculate how long each student has been enrolled in their course.
| Student Name | Admission Date | Current Date | Duration (Years) |
|---|---|---|---|
| Aritra Sen | 5-Jul-2021 | =TODAY() | =YEARFRAC(B2,C2) |
| Ritu Sharma | 12-Jan-2023 | =TODAY() | =YEARFRAC(B3,C3) |
| Raj Kumar | 10-Feb-2020 | =TODAY() | =YEARFRAC(B4,C4) |
🎯 Goal: Track total study period (e.g., 2.5 years) for academic reports.
💼 Project 2: Employee Service Record (HR Scenario)
Objective:
Calculate how many years each employee has completed in the company.
| Employee Name | Joining Date | Today | Service Years |
|---|---|---|---|
| Manish Roy | 15-May-2018 | =TODAY() | =YEARFRAC(B2,C2) |
| Sneha Ghosh | 1-Oct-2020 | =TODAY() | =YEARFRAC(B3,C3) |
| Rahul Das | 25-Nov-2022 | =TODAY() | =YEARFRAC(B4,C4) |
💡 Use the result for promotion eligibility or loyalty awards.
🏦 Project 3: Loan Tenure Calculation (Finance Scenario)
Objective:
Find how many years have passed since each customer’s loan started.
| Customer Name | Loan Start Date | Today | Loan Age (Years) |
|---|---|---|---|
| S. Mukherjee | 10-Jan-2019 | =TODAY() | =YEARFRAC(B2,C2) |
| A. Banerjee | 15-Sep-2021 | =TODAY() | =YEARFRAC(B3,C2) |
| P. Roy | 25-Mar-2023 | =TODAY() | =YEARFRAC(B4,C2) |
🏦 Goal: Determine loan maturity, calculate interest period, or review overdue accounts.
🧾 Project 4: Insurance Policy Age (Insurance Scenario)
Objective:
Calculate how old each policy is since its issue date.
| Policy Holder | Issue Date | Today | Policy Age (Years) |
|---|---|---|---|
| Rajiv Sen | 10-Jun-2020 | =TODAY() | =YEARFRAC(B2,C2) |
| Meena Das | 5-Jan-2018 | =TODAY() | =YEARFRAC(B3,C2) |
| Priya Singh | 25-Jul-2022 | =TODAY() | =YEARFRAC(B4,C2) |
📅 Goal: To identify which policies are eligible for renewal or maturity.
🚗 Project 5: Vehicle Age Tracker (Automobile Scenario)
Objective:
Find how old each vehicle is since its purchase or registration.
| Vehicle No. | Purchase Date | Today | Age (Years) |
|---|---|---|---|
| WB20A1234 | 10-Mar-2017 | =TODAY() | =YEARFRAC(B2,C2) |
| WB24B5678 | 20-Jan-2020 | =TODAY() | =YEARFRAC(B3,C2) |
| WB26C9876 | 15-Dec-2022 | =TODAY() | =YEARFRAC(B4,C2) |
🚘 Goal: Used by insurance or RTOs to assess vehicle depreciation or resale eligibility.
🧮 Extra Tip – Age Calculation in Years (with Fractions or Rounding):
-
Exact Decimal:
→ Returns 25.76 (years)
-
Rounded Whole Years (Age):
→ Returns 25 years
🧠 Key Insights:
✅ YEARFRAC() gives precise year differences (useful for financial or HR reporting).
✅ You can multiply by 12 to get the difference in months:
✅ Use with TODAY() for live updates — no need to change dates manually.
✅ Great for tracking project duration, insurance period, or policy age.