计算excel中的时差 [英] Calculate time difference in excel

查看:193
本文介绍了计算excel中的时差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个日期在excel1/2/2016 01:56:05和8/3/2016 06:21:46。如何以几天和几小时的格式计算它们之间的时差?



谢谢!

解决方案

假设日期在单元格 A1 A2 中,这将产生一个答案还有d:hh:mm格式的分钟。

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

删除 mm 如果您不需要分钟。



如果你想要文本:

  = INT(A2-A1 )& 天,& TEXT(A2-A1,h)& 小时

如果你想要分钟的文本:

  = INT(A2-A1)& 天,& TEXT(A2-A1,hhours,mminutes)

使用双引号相互转义引用本身,并允许额外的文本显示在字符串中。正如罗恩在答案中所说,在同一格式字符串中的 h 之后的 m 表示分钟,所以您可以保存一个额外的A2-A1计算通过放在一个单一的格式。


I have a two dates in excel "1/2/2016 01:56:05" and "8/3/2016 06:21:46". How do I calculate the time difference between them in a format of days and hours?

Thanks!

解决方案

Assuming the dates are in cells A1 and A2, this will produce an answer with minutes as well in d:hh:mm format.

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

Drop the :mm if you don't need minutes.

If you want text:

=INT(A2-A1) & " days, " & TEXT(A2-A1,"h") & " hours"

If you want text with minutes:

=INT(A2-A1) & " days, " & TEXT(A2-A1,"h"" hours, ""m"" minutes""")

Using double quotes alongside each other "escapes" the quote itself and allows the extra text to appear in the string. As Ron stated in his answer, the m following an h in the same format string indicates minutes, so you can save an extra A2-A1 calculation by putting both in a single format.

这篇关于计算excel中的时差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆