Get date difference in seconds

Clamarc

New Member
Joined
Apr 19, 2023
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hi,

My Excel is Prefessional plus 2016

How do I get the difference between two dates in seconds?
date1: 2024-06-21 11:20:35.740
data2: 2024-06-21 10:58:51.110

Note: dates are in the format yyyy/mm/dd hh:mm:ss,000

Thank's
 
It depends on the mechanism of how your log is being generated. There might be an efficient way to do it. A brute force way is to treat it as a string and extract the date/time components like this. The formula looks long but it's just doing the same thing twice. With a newer version of Excel (365), the formula can be shortened substantially.
Book1
BCD
32024-06-21 11:20:35.7402024-06-21 10:58:51.1101304.630
Sheet3
Cell Formulas
RangeFormula
D3D3=86400*(SUM(--LEFT(B3,FIND(" ",B3)),TIMEVALUE(MID(B3,FIND(" ",B3),LEN(B3))))-SUM(--LEFT(C3,FIND(" ",C3)),TIMEVALUE(MID(C3,FIND(" ",C3),LEN(C3)))))
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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