Calculate hours between two times in same column

rburns

New Member
Joined
Apr 6, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
1617740525108.png
Hi All - I've got a date column, and time stamps for that date in two separate columns. There are approx. 800 time stamps for each day, and three months of data per person. I'd like to calculate the difference between the earliest time stamp and latest to see how long the user was active in the system on that given date. In the example: for 1/4/2021, I'd like to know the difference in hours and minutes between the first time stamp of (09:41:24) and the last for the day (18:16:55). Again there are 3 months worth just for one user and we can't use a login/out report as they often do not logout and it times out after a substantial amount of time (and they are logged into multiple machines at the same time and the user time aggregates, therefore is incorrect). Any help would be greatly appreciated!
 

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 think that the best way to do this would be to create a pivot table with the dates as pivot rows, then two values columns for the times, one for min and another for max.

Looking at your screen capture, it appears likely that your dates and times are in text format, which means that they have no numeric value and may be difficult to perform any kind of analysis on, especially if the data is imported with hidden / zero width characters.
 
Upvote 0
I think that the best way to do this would be to create a pivot table with the dates as pivot rows, then two values columns for the times, one for min and another for max.

Looking at your screen capture, it appears likely that your dates and times are in text format, which means that they have no numeric value and may be difficult to perform any kind of analysis on, especially if the data is imported with hidden / zero width characters.
Thanks jasonb75! I did try that of course but am getting zeros showing for the times in the table. I thought it may be a formatting issue. Would you happen to know the solution of changing that data to numerical?
 
Upvote 0
You could try formatting the date column as date and the time column as time, then copy an empty cell, select all of the date and time cells, pastespecial and add.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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