如何在 Excel 2016 中显示两次之间的分钟差异

How to display difference in minute between 2 times in Excel 2016

他们是否有任何方法可以使用 excel 函数

来计算时、分、秒的差异

我试过了,但没有显示任何结果:

=INT(B2-A2) & " days, " & HOUR(B2-A2) & " hours, " & MINUTE(B2-A2) & " minutes and " & SECOND(B2-A2) & " seconds"

期望这样的输出:

输出

它显示一些类似的错误:#VALUE

这是因为 23-DEC-19 09.00.17.393922000 AM 不是 Excel 可以自动从文本解析为实际时间的格式。

您需要将文本更改为它可以解析的格式。为此,您需要将前两个 . 更改为 : 您可以使用 SUBSTITUTE 来做到这一点:

SUBSTITUTE(SUBSTITUTE(A2,".",":",2),".",":",1)

这会将字符串变成:

23-DEC-19 09:00:17.393922000 AM

哪个可以解析。

所以你的公式将是:

=INT(SUBSTITUTE(SUBSTITUTE(B2,".",":",2),".",":",1)-SUBSTITUTE(SUBSTITUTE(A2,".",":",2),".",":",1)) & " days, "
& HOUR(SUBSTITUTE(SUBSTITUTE(B2,".",":",2),".",":",1)-SUBSTITUTE(SUBSTITUTE(A2,".",":",2),".",":",1)) & " hours, "
& MINUTE(SUBSTITUTE(SUBSTITUTE(B2,".",":",2),".",":",1)-SUBSTITUTE(SUBSTITUTE(A2,".",":",2),".",":",1)) & " minutes and "
& SECOND(SUBSTITUTE(SUBSTITUTE(B2,".",":",2),".",":",1)-SUBSTITUTE(SUBSTITUTE(A2,".",":",2),".",":",1)) & " seconds"