The Excel YEARFRAC function returns a decimal value that represents fractional years between two dates. You can use YEARFRAC to do things like calculate age with a birthdate.

Get the fraction of a year between two dates

A decimal number

=YEARFRAC (start_date, end_date, [basis])

**start_date**- The start date.**end_date**- The end date.**basis**- [optional] The type of day count basis to use (see below).

YEARFRAC calculates a decimal number representing the fraction of a year between two dates. Excel uses whole days between two dates to work out the fraction of a year as a decimal value.

**Basis** - (optional) - the type of day count basis to use:

Basis 0: 30/360 - default (US convention)

Basis 1: Actual/actual

Basis 2: Actual/360

Basis 3: Actual/365

Basis 4: 30/360 (European convention)