X
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time.
This article has been viewed 112,903 times.
Learn more...
There are many reasons you might want to find the number of days or the months and years between two dates. This is how you can do it using MS Excel.
Steps
-
1Open MS Excel.
-
2Add the start date into one cell and the end date into another. Remember to format it as a "Date," not plain text or anything else.Advertisement
-
3Choose an output cell. Here you will be writing a pretty simple formula to calculate the difference between the dates.
-
4Switch to the formula bar. Here, write =DATEDIF(A1,B1,"d") (A1 being the cell with start date and A2 with the end date.) It will output the number of days between the two dates.
- The syntax is: =DATEDIF(start_date,end_date,mode)
- The various modes that can be used are "m", "y", "d", "ym", "yd", "md".
- "m" refers to only months.
- "y" refers to only years.
- "d" refers to only dates.
- "ym" filters off the unique years and returns the month difference between the dates as if both years were the same.
- "yd" filters off the unique years and returns the day difference between the dates as if both years were the same.
- "md" filters off the unique months and returns the day difference between the dates as if both months were the same.
-
5Use the formula within other formulas, if desired. You can append the necessary strings to make a multifunction formula. One common application is to list the number of years, months and days between two specific dates by applying the formula:
- =DATEDIF(A1,B1,"y") & " years, " & DATEDIF(A1,B1,"ym") & " months, " & DATEDIF(A1,B1,"md") & " days".
Advertisement
About This Article
Advertisement