on-internet
← Community

How to convert a column of duration text strings to numbers in minutes

Stack Overflow ·

I have a column (of known length) of duration text strings that contains potentially strings that are not duration. And I want to convert just the duration text strings to numbers in minutes. For example, A 14h 58m 30s 22h 28m 1d 7h 27m — Header 1d 20h 2m My plan so far is to extract the day, hour, minute, second numbers into an array for each row and check if any of them contains a real match, and if so, sum up the correct minutes. And thus, my formula is =let(ind_last_row,60 ,time,offset(A1,0,0,ind_last_row,1) ,time_2_arr,lambda(time,REGEXEXTRACT(time,"(\d*d)?\s*(\d*h)?\s*(\d*m)?\s*(\d*s)?")

Comments

Sign in or sign up to comment and upvote.

No comments yet.