Get Time from Timestamp Data

Steve001

Board Regular
Joined
Apr 13, 2017
Messages
62
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hello Everyone,

There is loads of time related subjects on here when i searched, but trying to find what i wanted and one that worked was difficult.

I have data from a Data logger that timestamps data example as below

12/03/2024 15:49:13:179

to

15/03/2024 07:40:43:179

What i want to do

Get the total run time

Days
Hours
Minutes
Seconds

Please put comments in any example code so i can understand whats happening and why

Regards

Steve
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
well, i though i could use a custom format for total days like [dd] but that did not seem to work. So this is a text calculation:
(it does not show milliseconds)

Mr Excel Questions 75.xlsm
ABC
112/03/2024 15:49:13:1792024-03-12 15:49:13
215/03/2024 07:40:43:1792024-03-15 07:40:432:15:51:30
Sheet6
Cell Formulas
RangeFormula
B1:B2B1=DATE(TEXTAFTER(TEXTBEFORE(A1," "),"/",2),TEXTAFTER(TEXTBEFORE(A1,"/",2),"/"),TEXTBEFORE(A1,"/"))+TIMEVALUE(LEFT(TEXTAFTER(A1," "),8))
C2C2=INT(B2-B1)&":"&TEXT(B2-B1,"hh:mm:ss")
 
Upvote 0
Hi Awoohaw

Is there a way of doing this in VBA ?

Steve
 
Upvote 0
what do you mean? A custom function?
 
Upvote 0
yes please if it is possible.
I will try the above in my sheet on Monday as it didn't work at home on my excel version

Regards

Steve
 
Upvote 0
it didn't work at home on my excel version
Speaking of Excel version(s) I suggest that you update your forum profile (click your user name at the top right of the forum, then ‘Account details’) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
I would have preferred to do this behind the sheet as i have macros doing other things in there

I can used a Cell out of the way and get the data that i need

@ Peter thank you - sorry i just tried this at home for now at work we are on office 365

@Dave thank you i will do this

Regards

Steve
 
Upvote 0
Thanks for the feedback.

If you are not concerned with the milliseconds, try the following

T240203a.xlsm
AC
112/03/2024 15:49:13:1792 15:51:30
215/03/2024 07:40:43:179
3
2a
Cell Formulas
RangeFormula
C1C1=LEFT(A2,19)-LEFT(A1,19)
 
Upvote 0
Hi Dave,

Can i ask in your example above how did you format the cells ?
I can get the Date to show or the time but not both as your example

Regards

Steve
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

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