Time Format entered as a decimal

fader5

New Member
Joined
Apr 15, 2008
Messages
6
I'm looking for a way to enter time (meaning hours, minutes and seconds) as a decimal
:03 entered as 3 or
25:03 entered as 25.3 or
1:25:03 entered as 1.25.3

Then find the difference between the two cells, but I want the format to show the time without any leading zeros

1.25.3 - 1.24.23 = :40
or
1.25.3 - 44.23 = 40:40
or
1.25.3 - 24.23 = 1:00:40

Hope this make sense.
Wilbur
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try

=SUBSTITUTE(A1,".",":")-SUBSTITUTE(B1,".",":")

Format the result as hh:mm:ss

Note : you would need to enter 44.23 as 00.44.23
 
Last edited:
Upvote 0
Try
=SUBSTITUTE(A1,".",":")-SUBSTITUTE(B1,".",":")
Format the result as hh:mm:ss
Note : you would need to enter 44.23 as 00.44.23

I'm trying to eliminate the input of any "0's" and I still get "0's" in the final results
below is a sample of your results
000:00:00
3.5703:57:00
0.8.323.57#########
10.260.8.3210:17:28
11.3310.261:07:00
1.26.4111.33#########
1.35.221.26.410:08:41
1.50.351.35.220:15:13
1.50.451.50.350:00:10

<colgroup><col span="2"><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
This will allow you to not input the leading 0.

=IF(LEN(B22)-LEN(SUBSTITUTE(B22,".",""))<2,SUBSTITUTE(A22,".",":")-SUBSTITUTE(0&"."&B22,".",":"),SUBSTITUTE(A22,".",":")-SUBSTITUTE(B22,".",":"))

But the results will show 0


 
Last edited:
Upvote 0
This will allow you to not input the leading 0.
=IF(LEN(B22)-LEN(SUBSTITUTE(B22,".",""))<2,SUBSTITUTE(A22,".",":")-SUBSTITUTE(0&"."&B22,".",":"),SUBSTITUTE(A22,".",":")-SUBSTITUTE(B22,".",":"))
But the results will show 0

It's close but, if I input minutes . seconds it comes out as hours . minutes (see below)

0 0:00:00
3.57 03:57:00
8.32 3.578:28:03
10.26 8.3210:17:28
11.33 10.2611:22:34
1.26.41 11.331:15:08
1.35.22 1.26.410:08:41
1.50.35 1.35.220:15:13
1.50.45 1.50.350:00:10

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
=if(and(len(b22)-len(substitute(b22,".",""))=1,len(a22)-len(substitute(a22,".",""))=1),substitute(0&":"&a22,".",":")-substitute(0&":"&b22,".",":"),if(len(b22)-len(substitute(b22,".",""))=1,substitute(a22,".",":")-substitute(0&":"&b22,".",":"),if(len(a22)-len(substitute(a22,".",""))=1,substitute(a22,".",":")-substitute(0&":"&b22,".",":"),substitute(a22,".",":")-substitute(b22,".",":"))))
 
Upvote 0
Ignore last one.........

=IF(AND(LEN(B22)-LEN(SUBSTITUTE(B22,".",""))<=1,LEN(A22)-LEN(SUBSTITUTE(A22,".",""))<=1),SUBSTITUTE(0&":"&A22,".",":")-SUBSTITUTE(0&":"&B22,".",":"),IF(LEN(A22)-LEN(SUBSTITUTE(A22,".",""))<=1,SUBSTITUTE(A22,".",":")-SUBSTITUTE(0&":"&B22,".",":"),IF(LEN(B22)-LEN(SUBSTITUTE(B22,".",""))<=1,SUBSTITUTE(A22,".",":")-SUBSTITUTE(0&":"&B22,".",":"),SUBSTITUTE(A22,".",":")-SUBSTITUTE(B22,".",":"))))
 
Upvote 0
We're really close!! Is there any way to eliminate the zero's? Would it help if the final output looks like time, because it doesn't have to function like time. It's just for informational purpose.

3 would be seen as 3 seconds
45 would be seen as 45 seconds
3:02 would be seen as three minutes and two seconds
 
Upvote 0
Try this as a custom format

[<0.0006944];[<0.0415][m]:ss;[h]:mm:ss

Code:
[TABLE="width: 260"]
<tbody>[TR]
[TD="width: 65"]1.25.3[/TD]
[TD="width: 65"]1.24.23[/TD]
[TD="class: xl63, width: 65, align: right"]0:00:40[/TD]
[TD="class: xl64, width: 65, align: right"]40[/TD]
[/TR]
[TR]
[TD]1.25.3[/TD]
[TD="align: right"]44.23[/TD]
[TD="class: xl63, align: right"]0:40:40[/TD]
[TD="class: xl64, align: right"]40:40[/TD]
[/TR]
[TR]
[TD]1.25.3[/TD]
[TD="align: right"]24.23[/TD]
[TD="class: xl63, align: right"]1:00:40[/TD]
[TD="class: xl64, align: right"]1:00:40[/TD]
[/TR]
[TR]
[TD="align: right"]1.8[/TD]
[TD="align: right"]0[/TD]
[TD="class: xl63, align: right"]0:01:08[/TD]
[TD="class: xl64, align: right"]1:08[/TD]
[/TR]
[TR]
[TD="align: right"]3.57[/TD]
[TD="align: right"]0[/TD]
[TD="class: xl63, align: right"]0:03:57[/TD]
[TD="class: xl64, align: right"]3:57[/TD]
[/TR]
[TR]
[TD]0.8.32[/TD]
[TD="align: right"]3.57[/TD]
[TD="class: xl63, align: right"]0:04:35[/TD]
[TD="class: xl64, align: right"]4:35[/TD]
[/TR]
[TR]
[TD="align: right"]10.26[/TD]
[TD="align: right"]8.32[/TD]
[TD="class: xl63, align: right"]0:01:54[/TD]
[TD="class: xl64, align: right"]1:54[/TD]
[/TR]
[TR]
[TD="align: right"]11.33[/TD]
[TD="align: right"]10.26[/TD]
[TD="class: xl63, align: right"]0:01:07[/TD]
[TD="class: xl64, align: right"]1:07[/TD]
[/TR]
[TR]
[TD]1.26.41[/TD]
[TD]0.11.33[/TD]
[TD="class: xl63, align: right"]1:15:08[/TD]
[TD="class: xl64, align: right"]1:15:08[/TD]
[/TR]
[TR]
[TD]1.35.22[/TD]
[TD]1.26.41[/TD]
[TD="class: xl63, align: right"]0:08:41[/TD]
[TD="class: xl64, align: right"]8:41[/TD]
[/TR]
[TR]
[TD]1.50.35[/TD]
[TD]1.35.22[/TD]
[TD="class: xl63, align: right"]0:15:13[/TD]
[TD="class: xl64, align: right"]15:13[/TD]
[/TR]
</tbody>[/TABLE]

 
Last edited:
Upvote 0
try this as a custom format

[<0.0006944];[<0.0415][m]:ss;[h]:mm:ss

Code:
[table="width: 260"]
<tbody>[tr]
[td="width: 65"]1.25.3[/td]
[td="width: 65"]1.24.23[/td]
[td="class: Xl63, width: 65, align: Right"]0:00:40[/td]
[td="class: Xl64, width: 65, align: Right"]40[/td]
[/tr]
[tr]
[td]1.25.3[/td]
[td="align: Right"]44.23[/td]
[td="class: Xl63, align: Right"]0:40:40[/td]
[td="class: Xl64, align: Right"]40:40[/td]
[/tr]
[tr]
[td]1.25.3[/td]
[td="align: Right"]24.23[/td]
[td="class: Xl63, align: Right"]1:00:40[/td]
[td="class: Xl64, align: Right"]1:00:40[/td]
[/tr]
[tr]
[td="align: Right"]1.8[/td]
[td="align: Right"]0[/td]
[td="class: Xl63, align: Right"]0:01:08[/td]
[td="class: Xl64, align: Right"]1:08[/td]
[/tr]
[tr]
[td="align: Right"]3.57[/td]
[td="align: Right"]0[/td]
[td="class: Xl63, align: Right"]0:03:57[/td]
[td="class: Xl64, align: Right"]3:57[/td]
[/tr]
[tr]
[td]0.8.32[/td]
[td="align: Right"]3.57[/td]
[td="class: Xl63, align: Right"]0:04:35[/td]
[td="class: Xl64, align: Right"]4:35[/td]
[/tr]
[tr]
[td="align: Right"]10.26[/td]
[td="align: Right"]8.32[/td]
[td="class: Xl63, align: Right"]0:01:54[/td]
[td="class: Xl64, align: Right"]1:54[/td]
[/tr]
[tr]
[td="align: Right"]11.33[/td]
[td="align: Right"]10.26[/td]
[td="class: Xl63, align: Right"]0:01:07[/td]
[td="class: Xl64, align: Right"]1:07[/td]
[/tr]
[tr]
[td]1.26.41[/td]
[td]0.11.33[/td]
[td="class: Xl63, align: Right"]1:15:08[/td]
[td="class: Xl64, align: Right"]1:15:08[/td]
[/tr]
[tr]
[td]1.35.22[/td]
[td]1.26.41[/td]
[td="class: Xl63, align: Right"]0:08:41[/td]
[td="class: Xl64, align: Right"]8:41[/td]
[/tr]
[tr]
[td]1.50.35[/td]
[td]1.35.22[/td]
[td="class: Xl63, align: Right"]0:15:13[/td]
[td="class: Xl64, align: Right"]15:13[/td]
[/tr]
</tbody>[/table]




perfect! Thanks so much
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,307
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top