# Google Sheets YEARFRAC Function: Syntax, Examples & Tips

- URL: https://betteranalyst.com/google-sheets/yearfrac-function
- Author: Better Analyst

Formula Bot is now Better Analyst—same account, more powerful analysis.Formula Bot is now Better Analyst—same account and workflows, with more powerful analysis, dashboards, and automation.

[Learn what changed](https://betteranalyst.com/formula-bot-is-now-better-analyst)

The YEARFRAC function calculates the fraction of the year represented by the number of whole days between two dates.

```
YEARFRAC(start_date, end_date, [day_count_convention])
```

Generate FormulaExplain Formula

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Describe the YEARFRAC you need in plain EnglishGenerate Formula

## 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:

| 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.

## YEARFRAC Formula

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.

## Result of the Formula

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.

## 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.

[Create Free Account](https://betteranalyst.com/signup)[Try Formula Generator](https://betteranalyst.com/excel-ai)

## Google Sheets how-to guides

- [How To Make A Table In Google Sheets](https://betteranalyst.com/google-sheets/how-to-make-a-table-in-google-sheets)
- [How To Merge Cells In Google Sheets](https://betteranalyst.com/google-sheets/how-to-merge-cells-in-google-sheets)
- [How To Multiply In Google Sheets](https://betteranalyst.com/google-sheets/how-to-multiply-in-google-sheets)
- [How To Password Protect An Google Sheets File](https://betteranalyst.com/google-sheets/how-to-password-protect-an-google-sheets-file)
- [How To Remove Blank Rows In Google Sheets](https://betteranalyst.com/google-sheets/how-to-remove-blank-rows-in-google-sheets)
- [How To Remove Duplicates In Google Sheets](https://betteranalyst.com/google-sheets/how-to-remove-duplicates-in-google-sheets)
- [How To Separate Names In Google Sheets](https://betteranalyst.com/google-sheets/how-to-separate-names-in-google-sheets)
- [How To Sort In Google Sheets](https://betteranalyst.com/google-sheets/how-to-sort-in-google-sheets)

## 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.](https://chatgpt.com/?prompt=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
2. [02ClaudeOpen the same research prompt in Claude.](https://claude.ai/new?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)
3. [03PerplexityResearch the comparison with linked web sources.](https://www.perplexity.ai/search?q=Compare%20Better%20Analyst%20with%20using%20a%20general-purpose%20AI%20assistant%20for%20data%20analysis.%20Evaluate%20spreadsheet%20and%20document%20analysis%2C%20dashboards%2C%20repeatable%20reports%2C%20code%20transparency%2C%20data%20connections%2C%20pricing%2C%20and%20limitations.%20Use%20current%20public%20sources%2C%20distinguish%20verified%20facts%20from%20assumptions%2C%20and%20explain%20which%20types%20of%20users%20each%20option%20fits%20best.)

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