Advertisement
Guides

How to use DATEDIF in Excel (2023)

The DATEDIF function is used to calculate the difference between two dates. This function returns the number of days, months, or years between two dates, depending on the unit value you specify. If you are new to Excel and don’t know how to use the DATEDIF function, look no further as this guide will teach you how to do it.

Excel: How to use the DATEDIF function (2023)

Advertisement

To use the DATEDIF function in Excel, you can type the following syntax in any cell:

=DATEDIF(start_date, end_date, unit)

Where the start_date and end_date are the dates you want to compare. They can be entered as text, serial numbers, or cell references. On the other hand, a unit is a value that determines how the difference is calculated (date, month, or year). Note that in the following syntax, you need to write the start and end dates inside the double quotes unless you are using the “TODAY()” function which is used to enter today’s date.

Unit Values

The unit values for the DATEDIF functions are as follows:

  • Type “Y” for years
  • Type “M” for months
  • Type “D” – for days
  • Type “MD” for days excluding months and years
  • Type “YM” for months excluding years and days
  • Type “YD” for days excluding years

For example, if you want to calculate how many months have passed since January 1st, 2001, you can use this formula:

=DATEDIF(“1/1/2001″, TODAY(),”M”)

This will return the number of complete months between January 1st, 2001, and today’s date. i.e. 279 months.

Syntax Errors

The DATEDIF function may return an error if:

  • The start date or end date values are not valid dates
  • The start date value is later than the end date value.
  • The unit value is not one of the valid values.

That’s everything covered on how to use the DATEDIF function in Excel. Also, check out our other guides, such as How to insert the drop-down list in Excel or How to delete the duplicate value in Excel.

Advertisement
Devendran

A Storyteller who is keen to learn something new about technology.

Recent Posts

Control 2 & Control Multiplayer Enter Production – Leak

A leaked revealed there are many big names in the production this summer, read for…

18 hours ago

Best Cheapest CS2 Skins

In this guide, we'll explore the cost of skins in CS2, what determines their prices,…

1 week ago

The Evolution of UK Bookmaking from Local to Digital

The history of the UK is interconnected with the tale of bookmaking, reflecting the rich…

4 weeks ago

When is Helldivers 2 Coming to Xbox?

What are Arrowhead Game Studios plan to release Helldivers 2 on Xbox? Here are some…

2 months ago

How To Find Median in Excel?

Here is the formula on how to find Median of a dataset in Microsoft Excel.

2 months ago

FF7 Rebirth Trophy Guide: All Trophies List And Platinum (100%)

Here's the list of all the FF7 Rebirth trophies including the Platinum trophy.

2 months ago