# Blog

#### How to do Datedif formula in Microsoft Excel

While working with dates in the excel we will stuck on some scenario where we need to calculate the period from the Starting Date to End Date where we required the Years,Months and Days .

In Excel we can get the solution for the above issue by using Datedif Function but unfortunately this function is not displaying in function list of the excel.

Formula Syntax for the Datedif Function=(Start Date,End Date,Unit) whereas Unit will be   Years="Y",Month="m",Days="d",  If the scenario where we need to three of them in a single cell for this for the month we write m="ym", and for the days we write d="md"

Eg.
Step 1
Calculation of the year from the joining date as on today , Formula is Datedif(Joining Date,Today(),"y")

Step-2
Calculation of the month from the joining date as on today , Formula is Datedif(Joining Date,Today(),"m")

Step-3
Calculation of the days from the joining date as on today , Formula is Datedif(Joining Date,Today(),"d")

Step-4
Calculation of the period from the Joining Date as Years,Month and Days
Formula =DATEDIF(C8,TODAY(),"y")&" Years "&DATEDIF(C8,TODAY(),"ym")&" Months "&DATEDIF(C8,TODAY(),"md")&" Days "