DATEDIF () function (calculate the total number of years, total months or total days from two given periods) in Excel

The DATEDIF () function helps you calculate the total number of years, the total number of months, or the total number of days from two given periods.

Processing and calculating data with data is time (type date) very difficult because you can not use normal calculations. But the DATEDIF () function will help you do this, the function will help you calculate the data of the format of time in Excel.

Picture 1 of DATEDIF () function (calculate the total number of years, total months or total days from two given periods) in Excel

The article describes the syntax and usage of the DATEDIF () function in Excel.

Description

The DATEDIF () function helps you calculate the total number of years, the total number of months, or the total number of days from two given periods.

You can use this function from Excel 2003 and newer versions, the DATEDIF () function is not in the list of Excel functions, so when you enter = DATEDIF, the function is not displayed in the Excel function list.

Syntax

= DATEDIF (start_day, end_day, unit)

Inside:

- start_day: start date to calculate.

- end_day: end date, end_day needs to be bigger than start_day.

- unit: type of result returned by the calculation, to be written in quotation marks.

Below is a list of unit options.

y: the number of years the difference between start_day and end_day.

m: number of months difference between start_day and end_day.

d: number of days difference between start_day and end_day.

md: the number of days difference between start_day and end_day, regardless of the number of years and months.

ym: the number of months difference between start_day and end_day, regardless of the number of years and days.

yd: number of days difference between start_day and end_day, regardless of the number of years.

For example

Example 1: Use the DATEDIF function to calculate the age of employees.

Apply the function to the last employee: = DATEDIF (D11, NOW (), "y")

- D11: is the start date (year of birth).

- NOW () is a function to get the current date of the computer.

- y to determine the return value is the difference between the current year and the year of birth.

The following results:

Picture 2 of DATEDIF () function (calculate the total number of years, total months or total days from two given periods) in Excel

Example 2: For start_day is February 1, 2013 and end_day is December 28, 2014, applying all unit options will result in the following:

Picture 3 of DATEDIF () function (calculate the total number of years, total months or total days from two given periods) in Excel

So you know how to use the DATEDIF () function in Excel. With the support of the DATEDIF () function, the processing of date data calculations will be a lot easier. Good luck!

Update 19 May 2020
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile