Advertisements

Excel DATEDIF Function

The Excel DATEDIF (DATE+DIF) function returns the difference between two dates in terms of years, months, or days. This function is useful for analysis with days, months, and years. Studies that need to find the impact of difference between dates require to use Excel DATEDIF Function. For example, in calculating age, users need to use DATEDIF Function.

In this section:

Advertisements

  1. Syntax of DATEDIF Function
  2. Example 1: Count number of days between two dates
  3. Example 2: Count number of months between two dates
  4. Example 3: Count number of years between two dates
  5. Example 4: Count number of days between two dates, ignoring month and year
  6. Example 5: Count number of month between two dates, ignoring year and day
  7. Example 6: Count number of days between two dates, ignoring year.

Excel DATEDIF Function

1. Syntax of DATEDIF Function:

DATEDIF(start_date,end_date,unit)

where:

UnitReturns
YThe number of complete years in the period.
MThe number of complete months in the period.
DThe number of days in the period.
MDThe difference between the days in start_date and end_date. The months and years of the dates are ignored.Important: We don’t recommend using the “MD” argument, as there are known limitations with it. See the known issues section below.
YMThe difference between the months in start_date and end_date. The days and years of the dates are ignored
YDThe difference between the days of start_date and end_date. The years of the dates are ignored.

2. Count the number of days between two dates:

To count the number of days between two dates, the formula is =DATEDIF(C6, D6, “d”), which returns the difference between dates in terms of days.

Excel DATEDIF Function

3. Count the number of months between two dates:

To count the number of months between two dates, the formula is =DATEDIF(C6, D6, “m”), which returns the difference between dates in terms of months.

Excel DATEDIF Function

4. Count the number of years between two dates:

To count the number of Years between two dates, the formula is =DATEDIF(C6, D6, “y”), which returns the difference between dates in terms of years.

Excel DATEDIF Function

5. Count days between dates, ignoring month and year:

Advertisements

To count the number of days between two dates, ignoring the month and year, the formula is =DATEDIF(C6, D6, “md”), which returns the difference between dates in terms of days, ignoring moth and year.

Excel DATEDIF Function

Note: The “MD” argument may result in a negative number, a zero, or an inaccurate result; therefore, be careful in the use of “MD” argument.

6. Count the number of month between dates, ignoring Year and Day:

To count the number of months between two dates, ignoring the year and day, the formula is =DATEDIF(C6, D6, “dy”), which returns the difference between dates in terms of months, ignoring year and day.

Excel DATEDIF Function

7. Count number of days between two dates, ignoring year:

To count the number of days between two dates, ignoring the year, the formula is =DATEDIF(C6, D6, “yd”), which returns the difference between dates in terms of days, ignoring year.

Excel DATEDIF Function

More related readings:

  1. MS Office post on DATEDIF Function
  2. Excel DATE Function
  3. Excel CONCAT Function
  4. Extract first Name in excel (3 practical examples)
  5. Extract Middle names (3 practical examples)
  6. Excel ARRAYTOTEXT Function
  7. Excel CLEAN Function with practical examples
  8. Excel CONCAT Function to join text
  9. Excel REPLACE Function to replace text
  10. Excel TRIM Function with Practical Examples
  11. Excel RIGHT Function
  12. How to generate tomorrow’s date in Excel

4 Responses

  1. Hi there I am so grateful I found your weblog, I really found you by mistake, while I was browsing on Bing for something else, Regardless I am here now and would just like to say thank you for a incredible post and a all round thrilling blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the fantastic work.

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisements