what is the formula which would enable me to calculate the difference between 2 dates and 2 times? Example: In the same cell, I have 01 January 2005 07:30 and in a second cell i would have 06 January 2010 19:29. The answer should be 1832 days and 11h59 minutes if i'm not mistaken. Can somebody help me?
|
Let's say A1 is
Now, right click on cell A3 and select "Format Cells...". Under the "Number" tab, select "Custom". Input the following value inside the "Type" box:
Now you can see the difference in hours and minutes. I didn't try making it display days, hours and minutes together, but you can play with the type variable to achieve it. In the earlier versions of Excel, there was a function called |
|||||
|
|
I probably over complicated this answer because the formula is ridiculously long, but it works. Assuming your start date is in A1 and your end date is in B1:
The result I get is: 1831 Days, 11 Hours, 59 Minutes It is different from the 1832 days you expected because it is exclusive of the end date. If you want it to be inclusive change the formula to:
I'd prefer an easier answer, but I can't think of one right now. Hopefully someone will save the day with a more efficient/elegant solution. |
|||
|
|
As Mehper mentioned, simple subtraction will yield the result 1831.49930555555. The numbers before the decimal place are days, and the numbers after represent the hours and mins in fraction of an hour. Subtract the number of days to get the remaining fraction, i.e. 1831.49930555555 - 1831 to get 0.49930555555 To be certain, you could use the following functions on the remaining fraction:
to get the exact hours, and...
to get the exact minutes... Wolfram Alpha is pretty good for such stuff too. |
|||
|
|
|
Assuming the dates are in A1 and A2:
yields:
|
|||||
|
|
|
My formulae weren't working because I'm using a French Excel version. Now that I've translated it, it works. |
||||
|
|