DiffY function

Date and Time Calculations category - Date Difference family Home 
What the name means"Difference in Years"
SyntaxDiffY ( Date1, Date2, [DayCount], [Periods] )
DescriptionCalculates the difference in years between two dates as Date2 - Date1
See also Excel functionsYEARFRAC (Related)
VariableType or ValueDescription
Inputs: (4)
1 Date1 Date One of 2 or more dates, and the lowest or earliest date
2 Date2 Date One of 2 or more dates
3 DayCount Float (Optional) Either a single number denoting the DayCount method, or a number in the form ww.ss where ww is the daycount of whole periods and ss applies to stub periods. See Using Daycount. (Optional)
4 Periods Annual Sequence (Optional) Either an option number, or a range of floats, describing the accruals periods or the timing of cash payments, in the format mm.dd for payments in advance or -mm.dd for payments in arrears. See Using Daycount (Optional)
Output:
Return Value Yrs Float A number of years.
Defaults and Values

The variable(s) of this function have certain defaults and/or switch values associated with them. Click here to see more.

Whats good or unique about it
Although this gives exactly the same results as Excel's YEARFRAC function for DayCount types 0-4, this function extends the DayCount options in two ways:
  • It includes type 5, ACTM/12
  • It includes type 6 ACT/ACT(in period) and allows you to specify the Daycount periods in the Periods variable.
In addition, Excel's YEARFRAC function always reports a positive, whereas DiffY reports a negative if Date1>Date2.
Examples
  • Preview of the DiffY example.
  • The above spreadsheet can be accessed from the Quick Reference (on the Business Functions menu), on the Examples menu, or in the Business Functions\Component Examples directory
Published Edition Changes in Behaviour

This function has experienced some changes in its behaviour over its history. Click here to see more.