Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating over 24 hrs 1

Status
Not open for further replies.

crmorgan

Technical User
Apr 11, 2009
6
US
I need help calculating time. I have a spreadsheet that calculates hours worked for employees. One column has clock-in time and the next column has clock-out time. The problem comes in when I have employees clock out on the next day. For example, he clocks in at 23:00 and clocks out at 07:00. How can I create a formula to recognize that the date has changed and give me an accurate subtraction?
 
Hi crmorgan,

See also:

[blue]faq68-5827[/blue]

Question: Where/how are the dates recorded on your spreadsheet?

GS

[red]******^*******
[small]I[/small] [small]Love[/small] [♥] [small]Redundancy.[/small][/red]
 
I'm sure the links provided are helpful but this is really a non-issue. If you have times that include dates (as you suggest), just subtract the earlier from the later regardless of whether they go over midnight and you should get the right answer.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 


FYI,

There is really a distinction that ought to be made between Date/Time, which is a point in time, and Duration, which is the difference between two Date/Time values, and can be expressed in terms of millinea, centuries, years, days, hours, minutes, seconds or any combination thereof.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 

Tony,

I agree that the difference between two date/time figures would give an accurate answer. However, I would be surprised if crmorgan is recording the date portion with each time entry. That's why I asked where/how the dates are entered.

He probably has the date recorded separately (as a header, perhaps) from the time, in which case he would need to combine them before doing the calculations.

GS

[red]******^*******
[small]I[/small] [small]Love[/small] [♥] [small]Redundancy.[/small][/red]
 
I'm with GS in thinking that the cell only contains a time, not a date & time.

But assuming that no one works a shift over 24 hours, then you can use the logic that If(EndTime < StartTime, 1+EndTime - StartTime, EndTime - StartTime)

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Oh, you just fire them.

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Fire them, too!

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 

Nice, John. At first glance I didn't think your solution would work for shifts over 12 hours, but a little testing eased my simple mind... it works perfectly.

Have a star (for the solution, not for being a heartless b...). [bigsmile]

GS

[red]******^*******
[small]I[/small] [small]Love[/small] [&hearts;] [small]Redundancy.[/small][/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top