,

DateDif: The “Secret” Excel Formula (Updated 11.14.2020)

calendar

For one reason or another, there is a perfectly functioning and pretty valuable formula that can be utilized in Excel that Microsoft has chosen to exclude from Excel’s list of functions: the DateDif function. This function is a valuable tool that can instantly calculate the number of days, months, or years between two dates.

While in Excel, if you click on the ‘fx’ button to the left of the formula ribbon and search for this function in the ‘Insert Function’ box, you will see that it is nowhere to be found. However, you can manually type the DateDif formula into a cell and by following the instructions in this post, get the results described.

Using DateDif In Real Estate Financial Modeling

The DateDif formula can be a valuable tool for real estate financial modeling and is a great function to have in your arsenal. For example, I use it in my Condominium Development Model as shown in the video. A second example can be found in the second tab of the downloadable excel file below where I use it to model for rental increases in a lease over time that has a start date prior to the analysis start.

DateDif Video Tutorial

The below video will walk you step by step through how the function work. Download the template below or simply open a blank Excel file on your computer and follow along.

DateDif Example
  • Sheet 1: Practice Example to use with the step-by-step guide
  • Sheet 2: RE Financial Modeling Example

Frequently Asked Questions about the DateDif Example Workbook

 

The workbook demonstrates how to use the DATEDIF function in Excel through a practice scenario and a real estate financial modeling application.

Sheet 1 includes a practice example designed to be used alongside a step-by-step instructional guide for learning the DATEDIF function.

Sheet 2 provides a real estate financial modeling example that applies the DATEDIF function in a CRE context.

The main function featured in this workbook is DATEDIF, which calculates the difference between two dates in various units (days, months, years).

The workbook has been downloaded 2,459 times.

DATEDIF is useful for calculating the duration of leases, loan terms, or investment holding periods with precision in months, years, or days, which is critical in financial modeling.


Video Walk Through Instructions

  • Step 1: In cell C9, type 1/1/2021
  • Step 2: In cell D9, type 5/26/2032
  • Step 3: In cell E9, type =DateDif(C9,D9,”d”)
    The d in quotation marks will return the number of days between the two dates, which should read 6,310.
  • Step 4: In cell F9, type =DateDif(C9,D9,”m”)
    The m in quotation marks will return the number of full months between the two dates, which should read 207 for this example. If there are additional days after a full month count is reached it will not include those days as an additional month. If you want to include that additional month, see sheet 2 in the downloadable Excel file.
  • Step 5: In cell G9, type =DateDif(C9,D9,”y”).
    The y in quotation marks will return the number of full years between the two dates, which should read 17 for this example. If there are additional days or months after a full year count is reached it will not include those days or months as an additional year. If you want to include that additional year, see sheet 2 in the downloadable Excel file.

Frequently Asked Questions about the DateDif Excel Formula

 

The DateDif formula calculates the number of days, months, or years between two dates. Although it’s not listed in Excel’s function menu, it can still be used manually. For example:
=DateDif(start_date, end_date, “d”) returns the number of days between the two dates.

Microsoft does not include DateDif in Excel’s ‘Insert Function’ list, despite it being functional. This makes it a “hidden” or undocumented formula, but it still works when typed directly into a cell.

It’s useful for calculating durations such as:

Time between lease start and analysis date

Length of holding periods

Timelines for rent escalations
The post mentions use cases in a Condominium Development Model and lease modeling scenarios.

“d” returns total number of days

“m” returns number of full months

“y” returns number of full years
Partial months or years are not counted. For example, 17 years and 11 months would return 17 with “y”.

No. DateDif only returns full days, months, or years. To include partial time periods, you’ll need additional logic. Sheet 2 of the downloadable Excel file offers guidance on how to account for that.

Yes. The post walks through an example with start date 1/1/2021 and end date 5/26/2032:

=DateDif(C9,D9,”d”) → 6,310 days

=DateDif(C9,D9,”m”) → 207 months

=DateDif(C9,D9,”y”) → 17 years

The post provides a downloadable Excel file with two sheets:

A practice example

A real estate modeling example
You can follow the instructions or watch the tutorial video included in the post.


About the Author: Michael has spent a decade working in various capacities on more than $7 billion of real estate transactions spanning all asset classes and geographies throughout the USA. Michael is both the founder of Firm Ridge Real Estate, which has a core focus on niche and emerging real estate strategies and A.CRE Consulting, a real estate advisory and financial modeling firm that has provided services on projects totaling more than $21 billion to date. Prior, Michael was a founding member and COO of Stablewood Properties, an institutionally backed real estate operator. And before Stablewood, Michael was at Hines in San Francisco.  Michael has both an MBA and Master in Real Estate with a concentration in Real Estate Finance from Cornell University.