I want to write a excel macro, which should calculate the seconds from the two datetime.
I have the following format of datetime in a single column.
DateColumn
--------------------------
2010-01-10-01.07.24.465000
2010-01-10-01.08.25.575000
How to calculate the how many seconds difference in the above datetime using macro?
You are looking for
Datediff()
Function.Here you got some documentation. You can choose seconds in the first parameter
Anyways it is better and easier to do this by formula.
I already answered this....
Excel 2010 : Find seconds between two date time =DATEVALUE(RIGHT(LEFT(B3,10),2)&"/"&RIGHT(LEFT(B3,7),2)&"/"&LEFT(B3,4))+TIMEVALUE(RIGHT(LEFT(B3,13),2)&":"&RIGHT(LEFT(B3,16),2)&":"&RIGHT(B3,9))
pretty bad form to repost... and not give any rep on the first one.
The
DateDiff
function will give you exactly what you need:You can find out about the various interval types (seconds in the example above) by looking here for more information