# MS EXCEL 2010 formula

I have 2 columns in excel, each column includes a date in the following format: mm/dd/yyyy.

One is a start date, the other is an end date.

Sample data: March 26, 2013 | February 28, 2014

Can anyone help with a formula which can look at each of these columns and produce a total length of time(ex. months) between the start date and end date?

-
Your sample data doesn't match your format somehow... Also, any reason why you cannot get the length of each individual row and add them up? – Jerry Jun 26 '14 at 15:13

You can use the DATEDIF function to calculate this. Assuming the dates were in the A and B columns the function would be entered as follows:

= DATEDIF (A1, B1, "D")

A1 - first date you want to compare.
B1 - second date you want to compare.
"D" - displays result in days. other formats are Y, M, YM, YD, and MD.

Make sure you format columns A and B with the Date format (select columns > right click > format cells > select date format you prefer). Column C should be a General type format.

-
@cLockeWork - Thats a lot simpler than using the DATEDIF function. I noticed that the outputs were different (339 for DATEDIF and 340 for your method) any idea as to why this is and which one is correct? I don't feel like counting out the days manually. – slow_excellence Jun 26 '14 at 17:08
Perhaps you mistyped something? The correct answer is 339 (think about it; it’s 365–26); but I get that answer from simple subtraction (e.g., `B1-A1`) in Excel. – Scott Jun 27 '14 at 0:02

`DATEDIF` is a depricated and undocumented function and may cause problems in use.

Luckily there is a very simple way to do this:

1 - Create a column next to your two columns and add to each cell this formula:

=[End Date]-[Start Date]

2 - Sum up the column

-