Peterso

Board Regular
Joined
Nov 28, 2012
Messages
110
I have a time value in a cell A1, say 40.56 second. I know I can get the second of 40 by writing x=Second(cells(1,1)). I would like to know how can I get the 0.56? It seems that it doens't have a funcation Millisecond. Thanks.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I have a time value in a cell A1, say 40.56 second. I know I can get the second of 40 by writing x=Second(cells(1,1)).

Actually, no you cannot

Not if the cell value is seconds as a decimal number -- literally 40.56.

And not even if the cell value is Excel time 0:0:40.56 formatted as .00 .

In the latter case, note that SECOND(A1) returns 41, not 40, because Excel rounds to the second.


I would like to know how can I get the 0.56?

It is unclear exactly what you want. 40.56 is 40 sec 560 milliseconds, not 56 milliseconds.

If the value in A1 is decimal seconds (literally 40.56):

seconds: INT(ROUND(A1,2))

milliseconds: 10*MOD(ROUND(100*A1,0),100)

Try with 40.556 and 40.996 formatted as Number with 2 decimal places.

----

If the value in A1 is Excel time 0:0:40.56 formatted as .00 :

seconds: INT(TEXT(A1,".00"))

milliseconds: 10*RIGHT(TEXT(A1,".00"),2)
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,422
Members
449,450
Latest member
gunars

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