Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert hh:mm:ss.000 to milliseconds in Excel?

Tags:

time

excel

I have a device which outputs the time in the format hh:mm:ss.000, e.g., 00:04:58.727 and I need to convert these to milliseconds.

I can't change the way the device outputs the times so I have to do it in Excel, but I don't know VB so am looking for a cell-by-cell solution.

like image 353
Return_Of_The_Archons Avatar asked Nov 18 '11 14:11

Return_Of_The_Archons


People also ask

How do I convert time to milliseconds in Excel?

In the Format Cells window, go to the Number tab, select Custom from the Category list, and enter h:mm:ss. 000 in the Type text box. As a result, all of the time values are displayed with milliseconds as decimals.

How do you convert HH mm SS to seconds in Excel?

To convert hh:mm:ss time format to minutes: =((HOUR(A2)*60)+MINUTE(A2)+(SECOND(A2)/60)); To convert hh:mm:ss time format to seconds: =HOUR(A2)*3600 + MINUTE(A2)*60 + SECOND(A2).

How do I calculate time difference between milliseconds on Excel?

There is also an elegant alternative to this solution: You can simply multiply the time value by 86400000 to convert it into milliseconds. This works because of the internal numeric format used by Excel where 1 is equal to 24h = 24h × 60min/h × 60s/min × 1000ms/s = 86400000ms.

How do I show time in microseconds Excel?

Select the time cells that you will show time with milliseconds, right click and select the Format Cells from the right-clicking menu. See screenshot: 2. In the opening Format Cells dialog box, go to Number tab, click to highlight the Custom in the Category box, and then type the format code hh:mm:ss.


2 Answers

Let's say that your time value is in cell A1 then in A2 you can put:

=A1*1000*60*60*24 

or simply:

=A1*86400000 

What I am doing is taking the decimal value of the time and multiply it by 1000 (milliseconds) and 60 (seconds) and 60 (minutes) and 24 (hours).

You will then need to format cell A2 as General for it to be in milliseconds format.

If your time is a text value then use:

=TIMEVALUE(A1)*86400000 

UPDATE

Per @dandfra's comment this solution may not work in the Italian version of Excel.

like image 180
Jon49 Avatar answered Nov 09 '22 23:11

Jon49


Using some text manipulation we can separate each unit of time and then sum them together with their millisecond coefficients.

To show the formulas in the cells use CTRL + `


Raw data view


Formula view

like image 42
Lewis Norton Avatar answered Nov 10 '22 01:11

Lewis Norton