date/time calc --- date and times are in different columns

dmj120

Active Member
Joined
Jan 5, 2010
Messages
308
Office Version
  1. 365
  2. 2019
  3. 2010
I've tried searching, and did find several threads about calculating time, but I didn't see anything that really connected with what I'm trying to do.

So I have a table with an "entry date/time" and "exit date/time" (see example). The time columns are formatted [$-F40]h:mm AM/PM. What I'd like to do is calculate the time (in hours) between the entry to exit times; and if the it goes across days, include the days. I'm not really firm on the "total time" format, I just want to be able to identify the number of days and hours if it goes multiple days, otherwise a simple hours/minutes will be cool.

Any ideas??

Something like:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Entry[/TD]
[TD][/TD]
[TD]Exit[/TD]
[TD][/TD]
[TD]Total time[/TD]
[/TR]
[TR]
[TD]8/15/2017[/TD]
[TD]1:30 pm[/TD]
[TD]8/15/17[/TD]
[TD]2:30 pm[/TD]
[TD]1 hour[/TD]
[/TR]
[TR]
[TD]8/15/2017[/TD]
[TD]12:00 pm[/TD]
[TD]8/20/2017[/TD]
[TD]1:30 pm[/TD]
[TD]5 days 1 hour 30 minutes[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Re: date/time calc --- date and times are in diffeent columns

Maybe something like this:
Under Format-Custom enter:
[TABLE="width: 265"]
<colgroup><col width="265"></colgroup>[TR]
[TD="width: 265"]d "day(s)" h "hour(s)" mm "minutes"
[/TD]
[/TR]
[/TABLE]
Excel Workbook
ABCDE
1EntryExitTotal time
28/15/20171:30 PM8/15/20172:30 PM0 day(s) 1 hour(s) 00 minutes
38/15/201712:00 PM8/20/20171:30 PM5 day(s) 1 hour(s) 30 minutes
Sheet
 
Upvote 0
Re: date/time calc --- date and times are in diffeent columns

Sweet, thanks!!
 
Upvote 0
Re: date/time calc --- date and times are in diffeent columns

You're welcome. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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