### Excel YEARFRAC Function

This Excel Tutorial demonstrates how to use the Excel YEARFRAC Function in Excel to return the fraction of the year between dates, with formula examples.

## YEARFRAC Function Description:

The YEARFRAC Function Returns the fraction of a year between two dates.

## Formula Examples:

ExampleFormulaResult
Positive=YEARFRAC(C5,D5)0.580555555555556
Negative=YEARFRAC(C6,D6)0.580555555555556
Basis 1: Actual/Actual=YEARFRAC(C7,D7,E7)0.581967213114754
Basis 4: European 30/360=YEARFRAC(C8,D8,E8)0.580555555555556

## Syntax and Arguments:

The Syntax for the YEARFRAC Formula is:

### Function Arguments ( Inputs ):

start_date – The start date in Excel serial number format or entered as a date with quotations (“s) surround the date. Example: You can not enter 11/12/2015 directly into the cell. Instead you need to enter “11/12/2015” or you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).

end_date – The end date in Excel serial number format or entered as a date with quotations (“s) surround the date. Example: You can not enter 11/12/2015 directly into the cell. Instead you need to enter “11/12/2015” or you would need to use the corresponding serial number: 42320. Alternatively, you can reference a cell with the date 11/12/2015 entered. Excel automatically converts dates stored in cells into serial format (unless the date is entered as text).

basis – The basis that determines the number of days in the year.

## Additional Notes

Enter the start and end dates. Optionally, you can change the basis used to determine the number of days in the year.

## YEARFRAC Examples in VBA

You can also use the YEARFRAC function in VBA. Type:
`application.worksheetfunction.yearfrac(start_date,end_date,basis)`
For the function arguments (start_date, etc.), you can either enter them directly into the function, or define variables to use instead.

Return to the List of all Functions in Excel

## How to use the YEARFRAC Function in Excel:

To use the AND Excel Worksheet Function, type the following into a cell:
`=AND(`
After entering it in the cell, notice how the AND formula inputs appear below the cell:

You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=YEARFRAC(” into a cell, without leaving the cell, use the shortcut CTRL + A (A for Arguments) to open the “Insert Function Dialog Box” for detailed instructions:

For more information about the YEARFRAC Formula visit the
Microsoft Website.

Posted in