Read duration text with 7 decimal places

Turn day.hh:mm:ss text with 7 decimals into a signed number of days.

What you'll make

In Excel: -2.01:30:15.5000000 becomes -2.062679 days.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1IF(LEFT(A8,1)="-", … )Drops a leading minus. LET calls the rest s."2.01:30:15.5000000"
2VALUE(TEXTBEFORE(s,"."))Takes the days before the first dot. LET calls it d.2
3TIMEVALUE(TEXTBEFORE(t,"."))Reads the clock time as part of a day.0.062674
4VALUE(TEXTAFTER(t,"."))/864000000000Turns the 7 decimals into part of a day.0.0000058
5LET( … )Adds the parts and puts the minus back.-2.062679

t is the text after the first dot (01:30:15.5000000). Excel counts time in days.

=LET(s,IF(LEFT(A8,1)="-",MID(A8,2,99),A8),d,VALUE(TEXTBEFORE(s,".")),t,TEXTAFTER(s,"."),IF(LEFT(A8,1)="-",-1,1)*(d+TIMEVALUE(TEXTBEFORE(t,"."))+VALUE(TEXTAFTER(t,"."))/864000000000))

How to use it

Yellow bar at the top? Click Enable Editing.

  1. See it work. The Example tab shows 20 made-up examples with the formula already in.
  2. Use your own durations. Paste durations like -2.01:30:15.5000000 into the green column of the Template tab. The days fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Keep these results as plain numbers. Excel shows #### for a negative time in a time format.

Microsoft's help: TEXTBEFORE function