ThisCalculator

Everyday

Excel Extract Milliseconds from Time?

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Excel Extract Milliseconds from Time?

Yes, you can extract milliseconds from a time value in Excel using a formula that separates the fractional second from the rest of the time. Enter your time in a cell, then use = (A1 - INT(A1)) * 86400000 to get the milliseconds as a number, or =TEXT(A1,"hh:mm:ss.000") to display them as text. The key is understanding that Excel stores times as decimal fractions of a day, and milliseconds are the part beyond the whole seconds.

Formula

To extract milliseconds from a time value in Excel, use this formula:

Milliseconds = (Time - INT(Time)) * 86400000

Where:

  • Time – the Excel time value (e.g., 0.0000115741 for 1 millisecond after midnight).
  • INT(Time) – the integer part of the time (the date portion, if any).
  • 86400000 – the number of milliseconds in a day (24 hours × 60 minutes × 60 seconds × 1000).

Excel stores all times as a decimal number between 0 and 1, where 0.5 represents 12:00 PM. The fractional part after the decimal represents the fraction of the day. Milliseconds are the thousandths of a second, so they appear as the digits after the third decimal place in the time’s decimal representation.

Worked Example

Using the default value from the calculator above: 0.0000115741 (which is 1 millisecond after midnight).

  1. INT(0.0000115741) = 0 (the integer part is 0).
  2. 0.0000115741 – 0 = 0.0000115741 (the fractional part).
  3. 0.0000115741 × 86400000 = 999.999… ≈ 1000 milliseconds.

So the result is 1000 ms, which matches the calculator output of 1000 ms (rounded to 0 decimals).

Understanding Excel Time Storage

Excel treats a time like 12:00:00.500 as the decimal 0.500005787… because it divides the day into 86,400 seconds. The milliseconds are the tiny fraction after the seconds. For example:

  • 12:00:00.000 → 0.5
  • 12:00:00.001 → 0.500000011574
  • 12:00:00.500 → 0.500005787

This is why simply formatting a cell as hh:mm:ss.000 shows milliseconds, but extracting them as a number requires multiplication by 86,400,000.

How to Extract Milliseconds in Excel

Follow these steps to get the milliseconds from a time cell:

  1. Assume your time is in cell A1.
  2. In another cell, enter: = (A1 - INT(A1)) * 86400000.
  3. Format the result cell as a number with 0 decimal places to see whole milliseconds.
  4. If you want to display the time with milliseconds as text, use: =TEXT(A1,"hh:mm:ss.000").

For times that include a date (e.g., 2025-01-15 08:30:00.250), the INT function removes the date part, so the formula still works.

Common Mistakes and Misconceptions

One common mistake is thinking that the MILLISECOND function exists in Excel – it does not. Excel only has SECOND, which returns 0–59. To get milliseconds, you must use the decimal method. Another mistake is using MOD(A1,1) instead of A1-INT(A1) – both work, but MOD can be slower in large datasets. Also, be aware that the TEXT function returns a text string, not a number, so you cannot perform arithmetic on it directly.

Alternatives: Using VBA or Power Query

If you need to extract milliseconds repeatedly, you can use a VBA macro:

Function GetMilliseconds(t As Date) As Long
    GetMilliseconds = (t - Int(t)) * 86400000
End Function

In Power Query, you can add a custom column with: Number.Round(([Time] - Number.IntegerDivide([Time],1)) * 86400000, 0). These methods are useful when you have many rows and need to automate the process.

Limitations and Precision

Excel’s precision for time values is about 1 millisecond (0.000000011574 days). This means times entered with more than 3 decimal places for seconds may lose accuracy. For example, entering 12:00:00.0001 may be rounded to 12:00:00.000. If you need microsecond precision, consider using a different tool like Python or a database.

Frequently Asked Questions

Does Excel have a MILLISECOND function?

No, Excel does not have a built-in MILLISECOND function. You must calculate it using the formula =(A1-INT(A1))*86400000 or use VBA.

How do I display milliseconds in a time format?

Right-click the cell, choose Format Cells, go to Custom, and enter hh:mm:ss.000. This shows milliseconds, but the cell still contains the full time value.

Why does my formula return 0 for milliseconds?

If your time is stored as text, Excel may not recognize it. Use VALUE(A1) to convert it. Also, ensure the cell is formatted as a time, not as text.

Can I extract milliseconds from a date-time value?

Yes, the same formula works because INT removes the date part. For example, =(A1-INT(A1))*86400000 will give the milliseconds from a datetime.

How do I round milliseconds to the nearest second?

Use =ROUND(A1*86400000,0)/86400000 to round to the nearest millisecond, or =ROUND(A1*86400,0)/86400 to round to the nearest second.

What if my time includes milliseconds but shows as 0.000?

This usually means the cell is formatted to show only whole seconds. Change the number format to hh:mm:ss.000 to see the milliseconds.

Related

Formula used
in t | Time (hh:mm:ss.000) | - | 0.0000115741 | 0
out ms | Milliseconds | ms | (t - INT(t)) * 86400000 | 0
out frac | Fraction of day | - | t - INT(t) | 6

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.