subtract datetime in excel

前端 未结 2 708
花落未央
花落未央 2021-01-21 22:20

I\'m trying to subtract two dates in two separate columns in excel, to find time difference. in h:mm format. The source format is the following.

11/18/2014 9:42:39 AM -

相关标签:
2条回答
  • 2021-01-21 22:38

    The calculation works correctly, but "hh" does not convert days to hours. Format the result as [h]:mm instead.

    0 讨论(0)
  • 2021-01-21 22:45

    Ok, the issue is that you need to convert the dates to number format, and then due the calculations.

    Step 1) Convert both dates to numbers, with 4 decimal places

    Step 2) Subtract the numbers, to give the time difference between the dates. The numbers before the decimal place are full days, and the numbers after the decimal place are hours, minutes, seconds, etc.

    Step 3) Use =Mod(XX11,1)*24 to separate the hours, minutes, seconds from the days, and calculate the number of hours. Repeat for minutes, and seconds, as needed, using 60 instead of 24.

    You will now have separate amounts of days, hours, minutes, etc. Put these together in a formula as necessary.

    0 讨论(0)
提交回复
热议问题