Skip to main content

Excel YEARFRAC function

Author: Sun Last Modified: 2024-09-27

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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...


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, Edge and Firefox.