Excel YEARFRAC function

doc workday.intl function 1

If you want to follow along with this tutorial, please download the example spreadsheet.
doc sample

Description

The YEAR function is used to calculate the fractional year in a decimal format between given dates.

Syntax and arguments

Formula syntax

YEARFRAC(start_date, end_date, [basis])

doc yearfrac function 2

Arguments

  • Start_date: Required. The start date that is used to calculate the fractional year, it cannot be a text.
  • End_date: Required. The end date that is used to calculate the fractional year, it cannot be a text.
  • Basis: Optional. The basis determines how to calculate the fractional year. If it is omitted, it is 0.

 Basis Day count basis 
 0 or omitted  30/360 (USA convention)
 1  Actual/Actual
 2 Actual/360 
 3 Actual/365 
 4 30/360 (European convention)  

Return Value

The YEAR function returns a decimal number.

Remarks

1. When using the US (NASD) 30/360 basis, and the start_date is the last day in February, the YEARFRAC function may return an incorrect result.

2. All arguments will be truncated to integer.

Errors

1. #VALUE! error appears when the argument start_date or end_date are invalid dates.

2. #NUM! error appears when the basis is out of range 0-4.

Usage and Examples

Example 1 Basic usage

To get the fractional year based on the start date in cell B3 and end date in cell C3, please use below formula:

=YEARFRAC(B3,C3)

doc yearfrac function 3

Press Enter key to get the result.
doc yearfrac function 4

In this example, the [basis] are omitted, you can use the type of basis as you need.

Example 2 Combine DATE function

Sometimes, you may want to directly type the dates as the argument start_date and end_date in the formula. For preventing errors, you can use the DATE function in the formula.

For instance, the start date is 12/1/2019, the end date is 1/3/2020, please use below formula:

=YEARFRAC(DATE(2019,1,12),DATE(2020,3,1))

doc yearfrac function 5

Press Enter key to get the result.
doc yearfrac function 6

In this example, the [basis] are omitted, you can use the type of basis as you need.


Relative Functions:

  • Excel YEAR Function
    The YEAR function returns the year based on the given date in a 4-digit serial number format.

  • Excel DAYS360 Function
    DAYS360 function can help you to return the number of days between two dates based on a 360-day year, which is considered to have 30 days in each month.

  • Excel WEEKNUM Function
    The WEEKNUM in Excel returns the week number of the given date in a year, which starts counting weeks from January 1.

  • Excel WORKDAY;Function
    The WORKDAY is used to add a specified number of workdays to a started date and returns the future or past date in a serial number format.


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.