Google Sheets YEARFRAC Function: Syntax, Examples & Tips

The YEARFRAC function calculates the fraction of the year represented by the number of whole days between two dates.
Google Sheets
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.

On this page
  1. Parameters
  2. What is YEARFRAC?
  3. A Practical Example
  4. YEARFRAC Formula
  5. Result of the Formula
  6. Why Use YEARFRAC?
  7. Key Takeaways:
  8. Example use case

Parameters

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.

What is YEARFRAC?

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.

A Practical Example

Imagine you are tracking the duration of investments and need to calculate the fraction of the year for each investment period:

Investment Table:

InvestmentIDStartDateEndDate
12023-01-012023-06-30
22023-03-152023-09-15

You want to find out how much of the year each investment period represents.

YEARFRAC Formula

To achieve this, you would use the YEARFRAC function as follows:

Google Sheets
=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.

Result of the Formula

When you apply the YEARFRAC formula to the Investment Table, the output would look like this:

InvestmentIDStartDateEndDateFractionOfYear
12023-01-012023-06-300.5
22023-03-152023-09-150.5

In this case, both investment periods represent half of the year.

Why Use YEARFRAC?

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.

Key Takeaways:

  • YEARFRAC: A Google Sheets function that calculates the fraction of the year between two dates.
  • Financial Analysis: Useful for interest calculations, depreciation, and investment evaluations.
  • Simplicity: Provides an easy way to quantify time periods without complex calculations.
  • Common Use Cases: Ideal for financial modeling, investment tracking, and any scenario where time duration needs to be assessed.

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!

Example use case

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.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.