Months difference between two dates ignoring days.
If you try to tie out Excel's DATEDIF function to CAS's mdiff funtion, you won't always tie out. This is especially true if you work with non first-of-month dates.
DATEDIF in Excel looks at the days value to calculate months difference, whereas mdiff in CAS only looks at the Months value.
To tie out to Excel's DATEDIFF function, use the following expression in CAS, where DATE1 is the later date and DATE2 is the earlier date: if ((day DATE1) lt (day DATE2))(0 max (DATE1 mdiff DATE2) minus 1)(0 max DATE1 mdiff DATE2)
1 plus MTDATE mdiff FPDATE
Date2 mdiff Date1
Name | Data Type | Input Type | Description | Optional | Default |
---|---|---|---|---|---|
Date2 | Date | Field, Constant | Ending Date | No |
Name | Data Type | Input Type | Description | Optional | Default |
---|---|---|---|---|---|
Date1 | Date | Field, Constant | Starting Date | No |
Type: Numeric
Months difference between the dates (Days are ignored)