Excel中怎样把用一个公式把下面天时分秒转换成小时?

2025-01-06 06:53:36
推荐回答(2个)
回答1:

A1:

=(IFERROR(LEFT(A1,FIND("天",A1)-1),0)+SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(RIGHT(A1,LEN(A1)-IFERROR(FIND("天",A1),0)),"小时",":"),"分钟",":"),"秒","")," ",""))*24

回答2:

如果把小时后面的分和秒都转化为小时,那么

=IF(LEN(A1)-12>0,LEFT(A1,LEN(A1)-12)*24,0)+IF(LEN(A1)-9>0,LEFT(RIGHT(A1,11),2),0)+IF(LEN(A1)-6>0,LEFT(RIGHT(A1,7),2)/60,0)+LEFT(RIGHT(A1,3),2)/3600
如果只需要整小时,那么
=IF(LEN(A1)-12>0,LEFT(A1,LEN(A1)-12)*24,0)+IF(LEN(A1)-9>0,LEFT(RIGHT(A1,11),2),0)