Home > Back-end >  Google sheets Get Duration from a string
Google sheets Get Duration from a string

Time:07-12

I want to get the duration dynamically from a string of text, like the example shown in the image example of input and output: enter image description here

I did try REGEXEXTRACT but it did not have lookahead or lookbehind features.
i would like to get days, hours, minutes as an intermediate step and the final duration.
minutes as decimal portions of 100 or 60 either way is acceptable.

CodePudding user response:

EDIT: You can do this on a single cell:

=IF(REGEXMATCH(A1;"\d days|day");REGEXEXTRACT(REGEXEXTRACT(A1;"\d day|days");"\d ");"")

Replace A1 with your cell, and day|days with whatever unit you want.

Hopefully this can solve your issue.

  • Related