Consulting | Excel Examples

Number of Days, Months and Years Between Two Dates

Keywords: Dates, User Defined Function

Description: Create a User Defined Function that uses the DateSerial function to calculate the time elapsed between two dates.

Tip: You can create a Visual Basic for Applications User Defined Function to return the number of years, months and days from a start date to an end date. Use the Function in formulas or to create a text string:
"As of yy/yy/yy, nn Years, mm Months and pp Days have elapsed from the start date xx/xx/xx".

Guide to the Example: The User Defined function Elapsed(StartDate As Date, EndDate As Date, ReturnType As Integer) will return the number of whole years, months and days depending on value of return type. See examples on Sheet1.

Download File: Click Here
Tip: Click on the link above and choose "Save" to download the xls workbook to your hard drive or "Open" to open the workbook inside of your browser.

Last modified: May 21, 1996