Excel Subtracting time

巧了我就是萌 提交于 2021-02-10 14:17:53

问题


Currently trying to setup a formula that will calculate the hours/minutes between two different hours of time.

I currently use the following formula in Cell D3 and receive 12:35am as the answer:

=C3-B3 

What I would want it to display is 35 minutes, which is the correct amount of time in between (6:42AM and 7:17AM).


回答1:


Something like this would work:

=TEXT(C3-B3,"[m]")

or if you want "minutes" written after

=TEXT(C3-B3,"[m] ""minutes""")


Examples:




回答2:


C3-B3 and formatted as [m] will work - either =TEXT(C3-B3,"[m]") or just giving the cell a custom number format of [m].

If Begin is 11:45PM and End is 12:15AM you'll only see ############# as both times are considered to be in the same day, while 12:15AM is the start of the next day.

Try =IF(C4<B4,(1+C4)-B4,C4-B4)
If C4 is less than B4 it adds 1 day to the value of End.




回答3:


You have to multiply your formula by the amount of hours in a day (24) and the amount of minutes in an hour (60) in order to convert.

So your formula should be the following.

=(C3-B3)*24*60



来源:https://stackoverflow.com/questions/42514295/excel-subtracting-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!