Format a time span as a number of days, hours and minutes

后端 未结 7 979
夕颜
夕颜 2020-12-11 00:50

This is purely an Excel sheet question.

I have a time span that is basically a difference between two cells, each containing a date:

I have managed to get th

7条回答
  •  悲哀的现实
    2020-12-11 01:12

    The following is certainly not the shortest formula and not a direct answer to the question but works to show the correct result (also on LibreOffice) in the following format:

    # days ## hours ## minutes ## seconds

    =CONCATENATE(TEXT(FLOOR(B2-A2,1),"@")," days ", IF(HOUR(A12)-HOUR(A11)<0,HOUR(A12)-HOUR(A11)+24,HOUR(A12)-HOUR(A11))," hours ",IF(MINUTE(A12)-MINUTE(A11)<0,MINUTE(A12)-MINUTE(A11)+60,MINUTE(A12)-MINUTE(A11)), " minutes ", TEXT(B2-A2,"s"), " seconds")
    

提交回复
热议问题