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 to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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