Forum Discussion

Richardkhill's avatar
Richardkhill
Copper Contributor
Nov 05, 2023
Solved

Covert text/number cell content to hh:mm:ss

Exported reports generated by a workplace system, record users total activity as 1 days, hh:mm:ss or 2 days, hh:mm:ss, etc. The report is usually over 300 rows long with multiple columns. I currently...
  • djclements's avatar
    Nov 05, 2023

    Richardkhill What does the report show if there's "0 days"? Does it show just the time (ie: 13:24:36)? Or does it still show "0 days, 13:24:36"? Either way, you can use a combination of the TEXTBEFORE and TEXTAFTER functions, wrapped inside the TEXT function to format the results as "[hh]:mm:ss".

     

    Example 1: "0 days, 13:24:36" format

     

    =TEXT(TEXTBEFORE(A2:A300," days, ") + TEXTAFTER(A2:A300," days, "), "[hh]:mm:ss")

     

    Example 2: "13:24:36" format (if 0 days)

     

    =TEXT(TEXTBEFORE(A2:A300," days, ",,,, 0) + TEXTAFTER(A2:A300," days, ",,,, A2:A300), "[hh]:mm:ss")

     

    Note: I've used range A2:A300 in this example for the range of values that need to be converted, and the formula was entered in cell B2. The results will spill for the entire range specified.

Resources