Excel YEARFRAC Function

What is the YEARFRAC Function in Excel?

The YEARFRAC function is one of the Date & Time functions of Excel.

It Returns the year fraction representing the number of whole days between start_date and end date.

We can find this function in Date & Time category of insert function Tab.

How to use YEARFRAC function in excel

  1. Click on an empty cell (like F5).
empty cell in excel

2. Click on the fx icon (or press shift+F3).

fx icon in excel

3. In the insert function tab you will see all functions.

insert function tab in excel

4. Select Date & Time category.

5. Select YEARFRAC function

6. Then select ok.

excel YEARFRAC function

7. In function arguments Tab you will see YEARFRAC function.

8. End date section is a serial date number that represents the start date.

9. Start date section is a serial date number that represents the end date.

10. Basis section is the type of day count basis to use.

11. You will see the result in formula result section.

How to use YEARFRAC function in excel

Examples of YEARFRAC function in excel

example 1:

How to calculate Fractions of the year in Excel

In the following example, as you can see in the photo, fraction of the year can be identified by the YEARFRAC function.

How to calculate Fractions of the year in Excel
=YEARFRAC("9/18/2022","12/29/2022",0) ----->>>>answer is  0.28
=YEARFRAC("9/19/2022","11/24/2022",1) ----->>>>answer is 0.18
=YEARFRAC("9/20/2022",'10/25/2022",2) ----->>>>answer is  0.097
=YEARFRAC("9/21/2022","12/26/2022",3) ----->>>>answer is  0.26
=YEARFRAC("8/22/2022","9/27/2022',4) ----->>>>answer is  0.13

example 2:

How to Calculate age from date of birth in Excel

In the following example, as you can see in the photo, Find age from date of birth can be identified by the YEARFRAC and TODAY and INT function.

How to Calculate age from date of birth in Excel
=INT(YEARFRAC("1/1/2000",TODAY())) ----->>>>answer is  23
=INT(YEARFRAC("10/5/2010",TODAY())) ----->>>>answer is  12
=INT(YEARFRAC("11/9/2020",TODAY())) ----->>>>answer is  2

YEARFRAC related functions

  • Use YEAR function to return the year of a date, an integer in the range 1900 – 9999.
  • Use DATE function to return the number that represents the date in Microsoft Excel date-time code.
  • Use DAY function to return the day of the month, a number from 1 to 31.
  • Use DAYS360 function to return the number of days between two dates based on a 360-day year.

Leave a Reply

Your email address will not be published. Required fields are marked *