Notices
Computer/Internet Issues & Troubleshooting Anyone with questions about the terribly complex world of computers or the internet should try here. NOT FOR REPORTING ISSUES WITH PPRuNe FORUMS! Please use the subforum "PPRuNe Problems or Queries."

Excel - Elapsed Time - Calc.

Old 17th February 2003 | 23:00
  #1 (permalink)  
Thread Starter

Eight Gun Fighter
 
Joined: Apr 2000
Posts: 1,126
Likes: 0
From: Western Approaches
Excel - Elapsed Time - Calc.

I know this subject has been touched on here and I have diligently searched and pulled up three related threads. I've messed around with every combination I can think of and failed so far.

I want to calculate elapsed time when the end time is over 24:00

eg.

Time on: 23:00
Time off: 00:30
Elapsed time = 1:30

thanks.
Rollingthunder is offline  
Old 17th February 2003 | 23:14
  #2 (permalink)  
25 Anniversary
 
Joined: Dec 1998
Posts: 4,282
Likes: 6
From: Escapee from Ultima Thule
I have a spreadsheet I made to calculate flight times to do just that.

I'll send you a copy if you like.

The way I found was to do a test to see if the end time was numerically less than the start time eg start at 22:00, finish at 02:00.

If yes, then add '1' to the finish time & then subtract start from finish.

Excel stores time as a decimal fraction, days are a whole number. Adding '1' has the effect of adding one whole day to the finish time ie 24 hrs.
Tinstaafl is offline  
Old 17th February 2003 | 23:51
  #3 (permalink)  
Thread Starter

Eight Gun Fighter
 
Joined: Apr 2000
Posts: 1,126
Likes: 0
From: Western Approaches
Thanks very much Tinstaafl. Please check your PM.

I worked it out formatted as numbers, but there's probably a future need to maintain it as time formatting for use with other data.

Cheers.
Rollingthunder is offline  
Old 18th February 2003 | 08:09
  #4 (permalink)  
 
Joined: Aug 2001
Posts: 117
Likes: 0
From: Europe
Hi Rollingthunder:

You can get around this quite easily by entering 24:30 (or the respective value +24, e.g. 25:45 instead of 01:45).

happy landings
dolly737 is offline  
Old 18th February 2003 | 13:47
  #5 (permalink)  
Thread Starter

Eight Gun Fighter
 
Joined: Apr 2000
Posts: 1,126
Likes: 0
From: Western Approaches
Hi Dolly and thanks. Unfortunately it's a question of taking crew data and dropping it into another spreadsheet for analysis. Getting a couple of hundred people to change the way they enter time would be harder than sorting out the formatting problem.
Rollingthunder is offline  
Old 19th February 2003 | 01:30
  #6 (permalink)  
Agent86
Guest
 
Posts: n/a
Post

If you are familiar with visual basic or modifying macros try this

Add this code to a module in the workbook

Function Timediff(startT, EndT)
Dim timediff1
timediff1 = DateDiff("n", startT, EndT)
If startT > EndT Then timediff1 = timediff1 + 1440
Timediff = TimeSerial(Int(timediff1 / 60), timediff1 Mod 60, 0)
End Function

then in the sheet where you want the calc to take place use the function Timediff

ie if start time is in cell D3 and end time is is cell D4 and you want the time difference to display in cell D5, type

=Timediff(D3,D4) into cell D5

You will need to format cell D5 to the time format for it to display correctly.

for info the "n" in the Datediff function is for Minutes and 1440 is obviously the number of minutes in a day.

PM me if you need help in adding a module as I don't know your experience level in VB and don't want to tell you how to suck eggs.

MAx
 
Old 19th February 2003 | 23:20
  #7 (permalink)  
25 Anniversary
 
Joined: Dec 1998
Posts: 4,282
Likes: 6
From: Escapee from Ultima Thule
Hiya RT

Can't email at the moment - Micro$hit OE is having hissy fit tonight so here it is in a nutshell:


Format the Beginning Time & Ending Time cells as a time format.

In the Time Interval column use the following formula


=IF(b1<a1,b1+1,b1)-a1


Cell 'A1' is beginning time

Cell 'B2' is ending time

These two cells and the time interal are formatted in ordinary 24:00 hr.

The only catch seems to be that the data entry by the users must use a colon ':' to separate hrs & minutes.

Hope it works OK for you.

T.
Tinstaafl is offline  
Old 22nd February 2003 | 00:15
  #8 (permalink)  
Thread Starter

Eight Gun Fighter
 
Joined: Apr 2000
Posts: 1,126
Likes: 0
From: Western Approaches
Thanks all, especially Tinstaafl

Works a treat.

Straightforward yet elegant.
Rollingthunder is offline  

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service

Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.