Home > Software engineering >  How to Convert Duration to Time on google sheets?
How to Convert Duration to Time on google sheets?

Time:06-08

I have duration data in text format like so:

19min 30s

I would like to convert this to hours and I need the hours to be integers. How do i do that? I have tried to split the text but I am unable to categorise the array into hours, minutes and seconds

CodePudding user response:

Try

=("0:"&textjoin(":",,REGEXEXTRACT(A1,REGEXREPLACE(A1,"(\d )","($1)"))))*24

enter image description here

CodePudding user response:

use:

=ARRAYFORMULA(IF(A2:A="",,
 IFNA(REGEXEXTRACT(A2:A, "(\d )h")/24) 
 IFNA(REGEXEXTRACT(A2:A, "(\d )min")/24/60) 
 IFNA(REGEXEXTRACT(A2:A, "(\d )s")/24/60/60)))

enter image description here

  • Related