Forum Discussion

zachary_king355's avatar
zachary_king355
Copper Contributor
Sep 18, 2019
Solved

Convert custom date format <day> <hour>:<minute>:<second> to something workable in excel?

hi Team,

 

looking for some help here!  have a data file which has 3 columns measuring a specific time and I need to calulate the difference between them.  the challenge i'm having is that the format in the file is as follows:

 

<day> <hour>:<minute>:<second>

 

I need to calculate the number of seconds between each stage, can you help???

Even if I minus the two, if stage 1 is at 3 23:55:13 and stage 2 is at 4 00:05:25 (ie #1 is before midnight and #2 is after) then i get weird negative values.  sample below.

 

any ideas?

 

Customer placed order datetimePlaced order with restaurant datetimeDriver at restaurant datetimeDelivered to consumer datetime
01 02:52:1201 03:00:2501 03:08:0901 03:35:20
13 15:58:5713 17:56:4513 18:24:3913 18:57:01
17 19:02:3717 19:12:5117 19:19:5917 19:31:09

 

 

 

  • SergeiBaklan's avatar
    SergeiBaklan
    Sep 18, 2019

    zachary_king355 

    You have texts, not datetime (which is actually an number in Excel). To receive the difference in seconds you need to parse these texts like

    =IFERROR((LEFT(D5,2)-LEFT(C5,2))+RIGHT(D5,8)-RIGHT(C5,8),"")

    and apply to the resulting cell [ss] custom format.

    IFERROR returns empty string if you have error in result, that happens if one of the texts is empty.

     

    Alternatively you may keep General format and convert result to seconds as

    =IFERROR( (LEFT(D5,2)-LEFT(C5,2)+RIGHT(D5,8)-RIGHT(C5,8) )*60*60*24,"")

     

    Please check in attached file.

11 Replies

Resources