Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Use the DATEDIF Function in Excel

Learn how to use DATEDIF Function in Excel, including its purpose, syntax, examples, and common errors, with clear step-by-step guidance.

Table of Contents

This guide explains how to use DATEDIF Function in Excel, including its syntax, required arguments, practical examples, and common errors.

How to Use the DATEDIF Function in Excel screenshot

Description: The function calculates the number of days, months and years between two dates in Excel. Functions are useful in formulas for calculating age numbers.

Syntax: DATEDIF (start_date, end_date, unit)

Inside:

- start_date: The first day or representing the first period of time you want to calculate, the date can be entered as text string or as a serial number.

- end_date: The last day or represent the last period you want to count.

- unit: The type of information you want to return, including the following values:

+ unit = 'Y' -> Returns the number of years in the period.

+ unit = 'M' -> Returns the number of months in the time period.

+ unit = 'D' -> Returns the number of days in the period.

+ unit = 'MD' -> Returns the difference between start_date and end_date dates, regardless of the month and year.

+ unit = 'YM' -> Returns the difference between months in start_date and end_date , regardless of the day and year.

+ unit = 'YD' -> Returns the difference between dates in start_date and end_date , regardless of the year.

Attention:

- Date values are stored as serial numbers in Excel.

- DATEDIF function is very useful in calculating age.

For example:

1. Calculate time intervals based on criteria according to the table described below with Unit options.

How to Use the DATEDIF Function in Excel screenshot 2

- In the cell to calculate, enter the formula: DATEDIF (E7, F7, G7).

How to Use the DATEDIF Function in Excel screenshot 3

- Press Enter -> return value is:

How to Use the DATEDIF Function in Excel screenshot 4

- Similarly copying the formula for the remaining values results:

How to Use the DATEDIF Function in Excel screenshot 5

2. Use the DATEDIF function to calculate the age of the following employees:

How to Use the DATEDIF Function in Excel screenshot 6

- In the cell to calculate, enter the formula: = DATEDIF (G7, NOW (), "Y").

How to Use the DATEDIF Function in Excel screenshot 7

- Press Enter -> the employee's age is:

How to Use the DATEDIF Function in Excel screenshot 8

- Similarly copying the formula for the remaining values results:

How to Use the DATEDIF Function in Excel screenshot 9

Above are instructions and some specific examples when using the DATEDIF function .

Good luck!

FAQ

What does the DATEDIF function do in Excel?

The DATEDIF function performs the calculation described in this guide. Use the correct arguments and compatible data types for reliable results.

How do I enter the DATEDIF function correctly?

Start with an equals sign, enter DATEDIF, add the required arguments inside parentheses, and confirm that cell references and separators are correct.

Why does the DATEDIF function return an error?

Common causes include missing arguments, invalid data types, incorrect cell references, unsupported values, or regional separator settings.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.