Adding time across days

phil_mccomb

New Member
Joined
Jul 21, 2013
Messages
7
Hi,
I have a timekeeping spreadsheet that adds hours and minutes from start time to finish time.

This works fine if you finish before midnight, but as soon as you go past midnight it counts backwards?

Is there a way to ensure it always counts up? The formula looks like this: =IF(((E6-D6)*1440/60>5.49),(((E6-D6)*1440)/60),(((E6-D6)*1440)/60))

E6=Finish time and D6=Start time (I know the answer for both is the same, but I leave that format so I can subtract a lunch break when required)

The first line is incorrect because i want it to add hours from 09:30 on day 1 until 07:00 on day 2 (which should add up to 21.5 hrs, not -2.5 hrs)

[TABLE="width: 557"]
<tbody>[TR]
[TD="colspan: 2"]Employee[/TD]
[TD][/TD]
[TD]Start time[/TD]
[TD]Finish time[/TD]
[TD]Total hours[/TD]
[/TR]
[TR]
[TD="colspan: 2"]McComb, Phil[/TD]
[TD][/TD]
[TD]9:30[/TD]
[TD]7:00[/TD]
[TD]-2.50[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]McComb, Phil[/TD]
[TD][/TD]
[TD]9:30[/TD]
[TD]19:00[/TD]
[TD]9.50[/TD]
[/TR]
</tbody>[/TABLE]



Thanks in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I'm assuming total hours is in F and Finish and Start are in E and D, respectively:

Code:
=(E6-D6+(E6 < D6))*24
<d6))*24[ code]

Be sure when you enter your time you are specific about AM/PM, even if your formatting won't show the distinction.</d6))*24[>
 
Last edited:
Upvote 0
Correct, hours in F and Finish start in E and C.

When I select either the start time or finish time it states AM/PM (ie: 9:30:00 AM) so I can safely assume it knows whether it is am or pm but I just can't get it to keep counting forward past midnight
 
Upvote 0
Perfect!!! (looks simple too... ) not sure why I had to *1440/60, but it was 5 years ago so I don't remember.

THANKS
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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