Previous in Forum: PUMPMAN welcomes any question about PUMPS   Next in Forum: Not superstitious?
Close
Close
Close
9 comments
Rate Comments: Nested
Associate

Join Date: Aug 2008
Location: Nigeria, West Africa (+1 GMT)
Posts: 46

Excel Application

12/25/2009 8:35 AM

Dear All,

I have a table containing records of Start Date&Time and the End Date&Time of various events in the format dd/mm/yyyy hh:mm as shown below,

Event Start Date/TimeEvent End Date/TimeDuration
27/08/2009 11:0727/08/2009 11:07
28/08/2009 22:0229/08/2009 14:03
29/08/2009 20:0230/08/2009 12:42
01/09/2009 15:4802/09/2009 08:22
02/09/2009 14:2103/09/2009 06:51
03/09/2009 12:5004/09/2009 05:22
05/09/2009 09:4206/09/2009 02:06
06/09/2009 08:0507/09/2009 00:32

I want to have the duration of each event on column C (Duration) in the format XXhrs,XXmins. How can I go about it please?

Best regards,

__________________
One good Thing deserves Another
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
Technical Fields - Technical Writing - New Member Engineering Fields - Piping Design Engineering - New Member

Join Date: May 2009
Location: Richland, WA, USA
Posts: 21017
Good Answers: 795
#1

Re: Excel Application

12/25/2009 2:13 PM

I don't remember for sure, and don't have Excel on this computer, but can you just subtract Bn - An? As a second possibility, you might be able to separate the dates and the times and subtract them individually (with some logic for subtracting a greater time from a lesser).

I'll try to play with this next time I use my other computer, with Excel.

__________________
In vino veritas; in cervisia carmen; in aqua E. coli.
Register to Reply
Guru
Panama - Member - New Member Hobbies - CNC - New Member Engineering Fields - Marine Engineering - New Member Engineering Fields - Retired Engineers / Mentors - New Member

Join Date: Dec 2006
Location: Panama
Posts: 4273
Good Answers: 213
#2

Re: Excel Application

12/25/2009 3:19 PM

Tornado is essentially correct, according to my experiences. What I do for this application is separate the date and time, making sure the time is formatted correctly, then subtract start time from end time. This creates an issue when the duration period crosses midnight, but I solve this by splitting the period by days- to formula should work better with the full date-time format, since the date is stored as a floating point number (the integer part representing the number of days since some starting date, and the decimal part representing some part of 24 hours). The key is making sure the format styles of the source and destination cells are properly set. Note that Excel has a bad habit of auto-formatting cells without your permission, if you make a typing error while trying to enter data (fix this by manually formatting all cells in a column after all the data are entered). If you are importing the data from another application, it is critical that you insure that the original data is in the floating point format, not text strings...

Register to Reply
Guru
India - Member - New Member

Join Date: Sep 2009
Location: Temporarily at Ashburn, VA
Posts: 2744
Good Answers: 164
#3

Re: Excel Application

12/25/2009 10:41 PM

i just subtracted the first from the second, reult in the 'Duration' column, formatted to show hh:mm:ss in 'custom' mode and voila !

i don't know if this is the right way..

Event Start Date/TimeEvent End Date/TimeDuration
27/08/2009 11:0727/08/2009 11:0700:00:00
28/08/2009 22:0229/08/2009 14:0316:01:00
29/08/2009 20:0230/08/2009 12:4216:40:00
01/09/2009 15:4802/09/2009 08:2216:34:00
02/09/2009 14:2103/09/2009 06:5116:30:00
03/09/2009 12:5004/09/2009 05:2216:32:00
05/09/2009 09:4206/09/2009 02:0616:24:00
06/09/2009 08:0507/09/2009 00:3216:27:00
__________________
Nothing worthwhile can ever be taught, it can only be learnt.
Register to Reply
Member

Join Date: Feb 2009
Posts: 8
Good Answers: 1
#4

Re: Excel Application

12/25/2009 11:07 PM

I not sure you have made it clear exactly what your looking for so I will try to cover several possibilities.

I assume you have the formula correct and the data is in correct date format. So you have as an example formula in column c2 would be is b2-a2.

I assume you have this correct and what your looking for is is actually the formatting into XXhrs,XXmins is your true question.

Highlight the cells you want and simply go to your menu in excel and choose [Format], then [Cells], then choose [Custom] in the category area, then in 'type' type or copy in the upper box exactly as follows:

[h]"hrs",mm"mins"

hit enter and you are set.

This is the resulting formatting is at the bottom.

Event Start Date/TimeEvent End Date/TimeDuration
27/08/2009 11:0727/08/2009 11:070hrs,00mins
28/08/2009 22:0229/08/2009 14:0316hrs,01mins
Register to Reply Score 1 for Good Answer
Anonymous Poster
#6
In reply to #4

Re: Excel Application

12/26/2009 1:55 PM

Thank you all.

Register to Reply
Participant

Join Date: Dec 2009
Location: Guatemala
Posts: 2
#5

Re: Excel Application

12/25/2009 11:38 PM

i think you can check the following:

in column C (Duration), Substract Column B from Column A, then apply special format to Column C (in Excel, right click - format cell - Custom - (h):mm:ss - enter, and copy this formula and format to all cells in column C.

Brgds

Register to Reply
2
Power-User
Engineering Fields - Civil Engineering - Member

Join Date: Apr 2007
Location: Island of Stone Money
Posts: 310
Good Answers: 5
#7

Re: Excel Application

12/26/2009 11:42 PM

First, make sure that the format of the Start Date & Time and the End Date & Time is in the form dd/mm/yyyy hh:mm (Format>Format Cells>Custom) Create the equation =bn-an for cell cn (b1-a1 for cell c1, or b2-a2 for cell c2, …, as the case maybe) for the Duration. Then, set the format of cell cn to [h]"hr.", mm"min." – this will yield the desired result and will remain valid even for a duration of more than 24 hours. The format hh:mm:ss will not hold true when the duration is more than 24 hours…try changing b2 to 30/08/2009 14:03… the duration 16hr., 01min. will remain the same. Try it!

*** Start Date & Time End Date & Time Duration
*** a b c
1 27/08/2009 11:07 27/08/2009 11:07 0hr., 00min.
2 28/08/2009 22:02 29/08/2009 14:03 16hr., 01min.
3 29/08/2009 20:02 30/08/2009 12:42 16hr., 40min.
4 01/09/2009 15:48 02/09/2009 08:22 16hr., 34min.
5 02/09/2009 14:21 03/09/2009 06:51 16hr., 30min.
6 03/09/2009 12:50 04/09/2009 05:22 16hr., 32min.
7 05/09/2009 09:42 06/09/2009 02:06 16hr., 24min.
8 06/09/2009 08:05 07/09/2009 00:32 16hr., 27min.
Format dd/mm/yyyy hh:mm [h]"hr.", mm"min."
__________________
"The more I learn, the more I know the less I've learnt"
Register to Reply Good Answer (Score 2)
Associate

Join Date: Aug 2008
Location: Nigeria, West Africa (+1 GMT)
Posts: 46
#8
In reply to #7

Re: Excel Application

12/27/2009 6:10 AM

I really appreciate. Thanks!

__________________
One good Thing deserves Another
Register to Reply
Guru
Engineering Fields - Electromechanical Engineering - Technical Services Manager Canada - Member - Army brat Popular Science - Cosmology - What is Time and what is Energy? Technical Fields - Architecture - Draftsperson Hobbies - RC Aircraft - New Member

Join Date: Sep 2006
Location: Clive, Alberta, Canada
Posts: 5916
Good Answers: 204
#9

Re: Excel Application

01/12/2010 1:26 AM

Dates in Excel are stored by the program as a Serial number (regardless of its format), which represents the number days since 1900... So you can simply subtract the later date from the earlier date, and it will be right.. .then the hh:mm:ss is treated as a plus or minus to that date.

http://www.cpearson.com/excel/datetime.htm

Chris

Register to Reply
Register to Reply 9 comments

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

Anonymous Poster (1); chrisg288 (1); cwarner7_11 (1); EnB (1); garcia119 (1); Guardian Filtration (1); kvsridhar (1); Tornado (1); willyap06 (1)

Previous in Forum: PUMPMAN welcomes any question about PUMPS   Next in Forum: Not superstitious?

Advertisement