YEARFRAC(start_date, end_date, [day_count_convention])One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
start_date:
The starting date from which to calculate the year fraction. This can be a date value, a date string, or a cell reference containing a date.
end_date:
The ending date up to which to calculate the year fraction. This can also be a date value, a date string, or a cell reference containing a date.
day_count_convention:
An optional parameter that specifies the day count convention to use for the calculation. This can be a number (1 to 4) representing different conventions, or omitted to use the default convention.
The YEARFRAC function in Google Sheets is a useful tool that calculates the fraction of the year represented by the number of whole days between two dates. This function is particularly helpful in financial analysis, where you may need to determine the proportion of a year that has elapsed between two dates, such as for calculating interest or depreciation.
In simpler terms, YEARFRAC allows you to find out how much of a year has passed between two specific dates.
Imagine you are tracking the duration of investments and need to calculate the fraction of the year for each investment period:
| InvestmentID | StartDate | EndDate |
|---|---|---|
| 1 | 2023-01-01 | 2023-06-30 |
| 2 | 2023-03-15 | 2023-09-15 |
You want to find out how much of the year each investment period represents.
To achieve this, you would use the YEARFRAC function as follows:
=YEARFRAC(B2, C2)In this formula:
B2 is the cell containing the StartDate of the investment.C2 is the cell containing the EndDate of the investment.When you apply the YEARFRAC formula to the Investment Table, the output would look like this:
| InvestmentID | StartDate | EndDate | FractionOfYear |
|---|---|---|---|
| 1 | 2023-01-01 | 2023-06-30 | 0.5 |
| 2 | 2023-03-15 | 2023-09-15 | 0.5 |
In this case, both investment periods represent half of the year.
YEARFRAC is beneficial because it simplifies the process of calculating the fraction of a year between two dates. It provides a straightforward way to analyze time periods in financial contexts, such as interest calculations, amortization schedules, and investment performance evaluations.
YEARFRAC is an essential function for anyone working with dates in Google Sheets, providing a powerful way to enhance financial analysis and reporting capabilities.
Happy spreadsheeting!
You have a table with employee start dates in Column A and their end dates in Column B. Use YEARFRAC to calculate the exact years of service for each employee, enabling accurate tenure tracking for benefits and retirement planning.
Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.
Browse our complete library of Google Sheets formula guides
Compare your options
Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.
AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.