Site icon Neotech Navigators

YEARFRAC Function in Google Sheets: How to Calculate Years Between Two Dates

If you’re working with dates in Google Sheets and need to calculate the exact number of years between two dates, the YEARFRAC function is here to save the day. In this blog post, we’ll dive into how to use the YEARFRAC function in Google Sheets to calculate the number of years (including fractions of years) between two dates.

We’ll take you through a practical example, explain the formula step by step, and show you the magic of how simple and efficient this function can be!

What is the YEARFRAC Function?

The YEARFRAC function calculates the difference between two dates in terms of years, giving you the fractional part of the year as well. This is especially useful when you want to determine the time period between two dates in terms of a decimal (e.g., 1.5 years).

YEARFRAC(start_ date, end_ date, [basis])

Now, let’s move on to a real-world example!

Example Data

Here is the dataset we’ll be working with. We have several employees, their start dates, and end dates. Using the YEARFRAC function, we want to calculate the exact number of years they’ve worked between their start and end dates.

YEARFRAC Function

The Formula: How It Works

We’ll use the following formula to calculate the number of years between each employee’s start date and end date:

=YEARFRAC(B4, C4)

Here’s what the formula does:

YEARFRAC(B4, C4): The function takes the start date from cell B4 and the end date from cell C4 and calculates the number of years between them. The result is a decimal number that includes any fractions of a year (for example, 1.5 means 1 year and 6 months).

By dragging this formula down the column, you can apply it to the entire dataset, calculating the number of years for all employees.

Explanation of the Formula:

Let’s break it down further:

The formula calculates the total number of years between these two dates, accounting for any partial years.

The result will give you the exact number of years worked, which might be a full number (like 2) or include a fraction (like 1.75 years).

Formula Output

Here’s the result after applying the formula:

The YEARFRAC function gives you the years worked in decimal form, meaning you can now easily identify employees who have worked for over 1 year or even those nearing their 2-year mark.

YEARFRAC Function

Why Use YEARFRAC?

You may wonder why not just count the number of years manually? Here are a few benefits of using the YEARFRAC function:

Final Thoughts

The YEARFRAC function in Google Sheets is a powerful tool for anyone working with date ranges. Whether you’re calculating employee tenures, project timelines, or anything involving periods of time, this function gives you a precise way to measure years, even including fractions.

Visit our YouTube channel to learn step-by-step video tutorials

Youtube.com/@NeotechNavigators

Click here to Make the copy of this Template

Exit mobile version