Hi Raj,
The reason why the difference in days is showing as 14 instead of 31 is because the formula is calculating the difference in 24-hour periods, not calendar days. To get the correct difference in days, you can use the
function in Excel.
Here's how you can do it:
- In cell A3, delete the current formula (=A2-A1).
- Enter the following formula in cell A3:
Formula:
=DATEDIF(A1,A2,"d")&" "&TEXT(A2-A1,"h:mm:ss")
- Press Enter.
The
function calculates the difference between two dates in a variety of units, including "d" for days. The
function is used to format the time difference as hours, minutes, and seconds.
The result in cell A3 should now show the correct difference in days and time. If you want to change the format of the result, you can modify the custom format in cell A3.