Excel,计数小时和分钟到天更多1个月

时间:2017-10-16 07:08:56

标签: excel

我有一个excel数据,其中包含要计算的范围日期

Created Time        Completed Time      Duration
07-Jan-2016 15:48   11-Jan-2016 15:39   3 Days 23:51
12-Jul-2016 11:28   28-Jul-2016 17:13   16 Days 05:45
12-Jul-2016 11:30   08-Nov-2016 10:40   118 Days 23:10
09/08/2016 14:45    31/08/2016 17:03    22 Days 02:18
09/08/2016 14:46    31/08/2016 17:04    22 Days 02:18

我在下面有这个公式,结果是“duration”coloumn。 CONCATENATE(TEXT(FLOOR(K4-J4; 1);“@”);“Days”; TEXT(K4-J4;“hH:mm”))

我想将那些数天转换成几个月...... 所以它将是3个月,28天23小时和10分钟(118天23:10)

需要你的帮助来解决我的问题:)

2 个答案:

答案 0 :(得分:0)

UNTESTED 假设Created Time在A1中,请在C2中尝试并向下复制以适应:

=INT((B2-A2)/30)& " Months "&INT(MOD((B2-A2),30))&" Days "&INT(24*(MOD((B2-A2),30)-INT(MOD((B2-A2),30))))&" Hours and "&MINUTE(B2-A2)&" Minutes"

答案 1 :(得分:0)

如果第一个创建时间在A2中且第一个完成时间在B2中,则在C2 =IF(DAYS(B2,A2)>0,CONCATENATE(IF(DATEDIF(A2,B2,"y")=0,"",DATEDIF(A2,B2,"y")),IF(DATEDIF(A2,B2,"y")=0,"", " year"),IF(DATEDIF(A2,B2,"y")>1,"s",""),IF(AND(DATEDIF(A2,B2,"y")>0,DATEDIF(A2,B2,"ym")>0),IF(IF(AND(DATEDIF(A2,B2,"md")>0,OR(DATEDIF(A2,B2,"y")>0,DATEDIF(A2,B2,"ym")>0))," and ","")=""," and ",", "),""),IF(DATEDIF(A2,B2,"ym")=0,"",DATEDIF(A2,B2,"ym")),IF(DATEDIF(A2,B2,"ym")=0,"", " month"),IF(DATEDIF(A2,B2,"ym")>1,"s",""),IF(AND(DATEDIF(A2,B2,"md")>0,OR(DATEDIF(A2,B2,"y")>0,DATEDIF(A2,B2,"ym")>0))," and ",""),IF(DATEDIF(A2,B2,"md")=0,"",DATEDIF(A2,B2,"md")),IF(DATEDIF(A2,B2,"md")=0,"", " day"),IF(DATEDIF(A2,B2,"md")>1,"s","")),"") & " " & HOUR(B2-A2) & " hours " & MINUTE(B2-A2) & " minutes"

中弹出以下公式