# 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).

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

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

4. Select Date & Time category.

5. Select YEARFRAC function

6. Then select ok.

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.

## 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.

``````=YEARFRAC("9/18/2022","12/29/2022",0) ----->>>>answer is  0.28

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.

``````=INT(YEARFRAC("1/1/2000",TODAY())) ----->>>>answer is  23