Excel Formula difference between two dates

You could use DATEDIF function to calculate duration

Syntax :

=DATEDIF(Start_Date, End_Date, Unit) or e.g =DATEDIF(A1,A2,"m").

inplace of unit replace the following to get the results

UNIT RETURNS

“Y” Returns the period difference as complete years.

“M” Returns the period difference as complete months.

“D” Returns the number of days in the period.

“MD” Returns the difference between the days in ‘Start_Date’ and ‘End_Date’. Here the months and years of the dates are ignored.

“YM” Returns the difference between the months in ‘Start_Date’ and

‘End_Date’. Here the days and years of the dates are ignored

“YD” Returns the difference between the days of ‘Start_Date’ and ‘End_Date’. Here the years of the dates are ignored.

Sample usage :

=DATEDIF(A1,A2,"m").


With data in A1 and A2 like:

enter image description here

In A3 use:

=A2-A1

enter image description here

and to see the difference is a more "readable" format use:

=INT(A2-A1) & " " & TEXT(A2-A1-INT(A2-A1),"hh:mm:ss")

enter image description here

The integer portion of the result is whole days difference.