YEARFRAC
Calculates the fraction of the year represented by the number of whole days between two dates
Syntax
YEARFRAC(start_date, end_date, [basis])
Arguments
| Argument |
Description |
Required |
start_date |
A date that represents the start date |
Required |
end_date |
A date that represents the end date |
Required |
basis |
The type of day count basis to use. Defaults to 0. |
Optional |
Examples
Calculate fraction of year between dates
=YEARFRAC(A1, A2)
Result ⇒
0.4972
Age calculation in years
=YEARFRAC(A1, A2)
Result ⇒
34
Interest calculation period
=YEARFRAC(A1, A2, 1)
Result ⇒
0.5
Related Functions
Other Date/Time functions:
- DATE - Constructs a date from year, month, and day values.
- DATEDIF - Calculates the number of days, months, or years between two dates
- DATEONLY - Extracts the date component from a datetime value, removing the time portion. The result is in workbook time zone.
- DAY - Returns the day of the month from a date value.
- DAYOFWEEK - Returns the day of the week as a text string
- DAYS - Returns the number of days between two dates
- EDATE - Returns a date on the same day of the month, n months in the past or future.
- EOMONTH - Returns last day of a month as a serial number after adding a specified number of months before or after another date.
- HOUR - Returns the hour component of a specific time as a number between 0-23.
- ISOWEEKNUM - Returns the ISO-8601 week number (1–53) of the year for a given date.
- MINUTE - Returns the minutes of a time value
- MONTH - Returns the month from a date value (1-12).
- NETWORKDAYS - Returns the number of work days between two dates, excluding saturday and sunday.
- NOW - Returns the current date and time as a date value in UTC.
- SECOND - Returns the seconds of a time value
- TIME - Returns the created time with individual hour, minute and second components.
- TIMEVALUE - Returns the decimal number of the time represented by a string. The decimal number is a value ranging from 0 (inclusive) to 1 (exclusive).
- TODAY - Returns the current date as a date value in UTC with time stripped.
- WEEKDAY - Returns the number that corresponds to the week of provided date.
- WEEKNUM - Returns the week number of a specific date
- WORKDAY - Returns the date that is the specified number of working days before or after the start date.
- YEAR - Returns the year from a date value.
← Back to Formula Reference