Go Back

Excel YEARFRAC Function

We can use the Excel YEARFRAC function to extract the number of days between two dates as a fraction of a specified year.  We will work through the process of using this function in the simple steps below.

Figure 1: Result of the Excel YEARFRAC function

General Formula

=YEARFRAC(start_date, end_date, [basis])

Formula

=YEARFRAC(B4,C4)

Setting up the Data

  • We will set up our data by inputting the Start Date in Column B
  • Column C will contain the End date
  • Column D is where will we input the formula to derive the result

Figure 2: Setting up the Data

Applying the YEARFRAC function

  • We will click on Cell D4
  • We will input the formula below in the cell
    =YEARFRAC(B4,C4)
  • Next, we will press the enter key

Figure 3: Applying the Excel YEARFRAC function

  • We click again on Cell D4 and use the fill handle tool (a plus sign found at the base of Cell D4) to drag down the formula into the other cells.

Figure 4: Result using the Excel YEARFRAC function

Explanation

We use the YEARFRAC function to calculate the fractional year between two dates. This function will return with the decimal value which is the fraction of a year between the two periods. We can also use this function to calculate birthdate, retirement dates, number of years between two particular dates, etc.

Notes:

  • If the dates entered are returning with an error, check whether they are introduced as text and change your approach by entering them with the DATE() function.
  • If your dates are not valid, then you will have the #VALUE! Error.
  • If basis>0 or if basis <4 then YEARFRAC function will return error #NUM!

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

in cell G2 in the valuable worksheet, enter the YEARFRAC function to calculate the number of years from the release date and the date in cell Q2. Use relative and mixed references correctly. format the value with comma style with one decimal place. copy the function to the range G3:G40
Solved by G. L. in 12 mins
normal distribution function in excel
Solved by T. A. in 23 mins
I need help on how to use indirect function along with sumifs function in excel.
Solved by Z. W. in 15 mins

Leave a Comment

avatar