How do I display time with fractional seconds?

roscoe

Well-known Member
Joined
Jun 4, 2002
Messages
1,062
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I need to display time in a cell in 24hr format to the nearest 10th of a second, i.e. 23:21:07.3. The data came to me as number of milliseconds in the day. I have no problem calculating the hrs, minutes, and seconds, and displaying in 24hr is easy...but how do I get the ".3" part to display? My input to the Time() function includes it so I assume it's there.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I just realized that instead of my crazy formula, I could just convert the milliseconds to seconds (/1000), then convert to fraction of a day (/24/60/60) and format as a time and voila. Problem is that it rounds the seconds up so at 5.5 seconds it's displaying "6". Even more imperative to display the ".5" part of the time.

Can it be done?

Thanks!
 
Upvote 0
The "pass through millisecond format" is a good way to do this.

But for general information, the custom format .000 will return a time in seconds with decimal seconds, such that half of 1 hour, 3 seconds will be shown as 1801.500.
 
Upvote 0
Nevermind...it out that the purpose I needed it can accept in in text format, so that was trivial to create
 
Upvote 0
I need to display time in a cell in 24hr format to the nearest 10th of a second, i.e. 23:21:07.3. The data came to me as number of milliseconds in the day. I have no problem calculating the hrs, minutes, and seconds, and displaying in 24hr is easy...but how do I get the ".3" part to display? My input to the Time() function includes it so I assume it's there.

Assuming that you want to display a duration in cell J2 with fractional seconds and you have the duration in terms of seconds since the beginning. You use

=TIME(TRUNC(J2/3600,0),TRUNC((J2-TRUNC(J2/3600,0)*3600)/60,0),(J2-TRUNC(J2/60,0)*60))+(J2-TRUNC(J2,0))/(24*3600)

The +(J2-TRUNC(J2,0))/(24*3600) adds the fractions of a second.

In general the time function seems to ignore any fraction of seconds. So you have to add it back in

time(h,m,s)+fraction of second per day.
 
Upvote 0

Forum statistics

Threads
1,220,964
Messages
6,157,102
Members
451,396
Latest member
jdarner

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