Syntax
=YEARFRAC(start_date, end_date, [basis])Arguments
| Argument | Required | Description |
|---|---|---|
start_date | Required | The first date |
end_date | Required | The second date |
basis | Optional | 0 US 30/360 (default), 1 actual/actual, 2 actual/360, 3 actual/365, 4 European 30/360 |
How to use YEARFRAC
YEARFRAC takes 2 required arguments and 1 optional argument. Type =YEARFRAC( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.
Examples
Each result below was calculated by the SheetsBat formula engine.
=YEARFRAC(DATE(2012,1,1), DATE(2012,7,30))Result =YEARFRAC(DATE(2012,1,1), DATE(2012,7,30), 1)Result =YEARFRAC(DATE(2012,1,1), DATE(2012,7,30), 3)Result Related date and time functions
- SECONDReturns the second (0 to 59) of a time.
- TIMEBuilds a time of day from hours, minutes and seconds.
- TIMEVALUEConverts a time written as text into a fraction of a day.
- TODAYReturns the current date.
- WEEKDAYReturns the day of the week of a date as a number (by default 1 for Sunday to 7 for Saturday).
- WEEKNUMReturns the week number of a date in its year (the week containing January 1 is week 1).
- WORKDAYReturns the date a number of working days (Monday to Friday) before or after a date, skipping holidays.
- WORKDAY.INTLReturns the date a number of working days before or after a date, with a choice of weekend days and holidays.
- YEARReturns the year of a date.