Spreadsheets: Calculating fraction of a year: yearfrac() function

The tutor shows an example of how to use the yearfrac() function in Excel or LibreOffice Calc.

Example: Find the fraction of a year between January 10, 2016, and June 2, 2016.

Solution:

  1. In Excel or LibreOffice Calc, select a cell.
  2. Type the following:
    =yearfrac(date(2016,01,10),date(2016,06,02),1)
  3. Press Enter.

Hopefully you receive the answer 0.39344

The third parameter (which is set at 1 in the example above) can be set 0,1,2,3, or 4: the options include a 30-day month, a 360-day year, or the actual length of a given month and year, etc. If you leave it blank or zero, it uses the American 30-day month, 360-day year system. “1” means actual values of days.

HTH:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply