Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How to conditionally sum numeric data in an Excel table using SUMIFS
  • How to create a Histogram in Excel
  • How To Sort One Column or Multiple Columns in Excel
  • Conflicting Multiple Conditional Formatting Rules in Excel
  • How to count table columns in Excel

References

  • How to reference named range different sheet in Excel
  • How to create dynamic named range with OFFSET in Excel
  • Get nth match with INDEX / MATCH in Excel
  • How to get first row number in range in Excel
  • Two-way lookup with VLOOKUP in Excel

Data Validations

  • Excel Data validation require unique number
  • Excel Data validation date in next 30 days
  • Excel Data validation unique values only
  • How To Create Drop-down List in Excel
  • Excel Data validation with conditional list

DATEDIF function: Description, Usage, Syntax, Examples and Explanation

by

What is DATEDIF function in Excel?

DATEDIF function is one of Date and Time functions in Microsoft Excel that calculates the number of days, months, or years between two dates. Warning: Excel provides the DATEDIF function in order to support older workbooks from Lotus 1-2-3. The DATEDIF function may calculate incorrect results under certain scenarios.

Syntax of DATEDIF function

DATEDIF(start_date,end_date,unit)

Start_date:     A date that represents the first, or starting, date of the period. Dates may be entered as text strings within quotation marks (for example, “2001/1/30”), as serial numbers (for example, 36921, which represents January 30, 2001, if you’re using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE(“2001/1/30”)).

Worked Example:   How to calculate months between dates in Excel

End_date:     A date that represents the last, or ending, date of the period.

Note: If the Start_date is greater than the End_date, the result will be #NUM!.

Unit     The type of information that you want returned:

Unit Returns
“Y” The number of complete years in the period.
“M” The number of complete months in the period.
“D” The number of days in the period.
“MD” The 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.

“YM” The difference between the months in start_date and end_date. The days and years of the dates are ignored
“YD” The difference between the days of start_date and end_date. The years of the dates are ignored.
Worked Example:   How to get number of days, weeks, months or years between two dates in Excel

DATEDIF formula explanation

  • Dates are stored as sequential serial numbers so they can be used in calculations. By default, December 31, 1899 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.
  • The DATEDIF function is useful in formulas where you need to calculate an age.

Examples of DATEDIF function

Steps to follow:

Worked Example:   Get days between dates ignoring years in Excel

1. Open a new Excel worksheet.

2. Copy data in the following table below and paste it in cell A1

Note: For formulas to show results, select them, press F2 key on your keyboard and then press Enter.

You can adjust the column widths to see all the data, if need be.

Start_date End_date Formula Description (Result)
1/1/2001 1/1/2003 =DATEDIF(Start_date,End_date,”Y”) Two complete years in the period (2)
6/1/2001 8/15/2002 =DATEDIF(Start_date,End_date,”D”) 440 days between June 1, 2001, and August 15, 2002 (440)
6/1/2001 8/15/2002 =DATEDIF(Start_date,End_date,”YD”) 75 days between June 1 and August 15, ignoring the years of the dates (75)

Post navigation

Previous Post:

DCOUNT function: Description, Usage, Syntax, Examples and Explanation

Next Post:

231 Keyboard Shortcut Keys In Excel

Leave a Reply Cancel reply

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

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to use Excel AND Function
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • IFS function: Description, Usage, Syntax, Examples and Explanation
  • Check multiple cells are equal in Excel

Date Time

  • Get month name from date in Excel
  • ISOWEEKNUM function: Description, Usage, Syntax, Examples and Explanation
  • Get work hours between dates and times in Excel
  • Convert decimal hours to Excel time
  • How to Calculate Age in Excel

Grouping

  • Group numbers at uneven intervals in Excel
  • Calculate conditional mode with criteria in Excel
  • Categorize text with keywords in Excel
  • Map text to numbers in Excel
  • If cell contains one of many things in Excel

General

  • Zoom Worksheet in Excel
  • How to fill cell ranges with random text values in Excel
  • How to Delete Cells, Row and Rows in Excel
  • How to get Excel workbook path only
  • Subtotal by color in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning