0

In Microsot Excel, I have string data that represents duration of an event:

duration
40s
5m, 40s
59m, 59s

I need to convert the values to time (in adjacent column) so that I can format and sort the data properly. For example:

duration seconds formatted
40s 40 00:00:40
5m, 40s 340 00:05:40
59m, 59s 3599 00:59:59
2
  • 1
    @MayukhBhattacharya I think {0,60,1} should be {3600,60,1} if you want to include hours.
    – Paul
    Commented Nov 1, 2023 at 16:18
  • Yes sorry I missed it! I will update in answers. Removed the comment since there was a typo! Commented Nov 1, 2023 at 16:26

1 Answer 1

1

Two alternative options, you could try:

enter image description here


• Formula used in cell B2

=SUM(IFERROR(MID("0"&A2,SEARCH({"d","h","m","s"},A2)-1,2),0)*{"1","1:0","0:1","0:0:1"})*86400

Or,

• Formula used in cell C2

=SUM(IFERROR(MID(0&A2,SEARCH({"d","h","m","s"},0&A2)-2,2),{0,0,0,0})*{86400,3600,60,1})

And in D2

=B2/24/60/60

Format cells as [h]:mm:ss;@


7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .