Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Excel- Data Merging 1

Status
Not open for further replies.

themaniac

Aerospace
Sep 8, 2003
16
0
0
AU
Hey People,

I've been using that wonderful little program by Microsoft (don't we all love them!!) called excel and naturally am having a few problems.

I have a data spreadsheet with several time related columns (ie hours, minutes, seconds). I would like to merge those 3 columns into one time column so it displays something like hh:mm:ss.

If anyone has any ideas on how to do this I would be most grateful.

Thanks

"Yesterday I couldn't spell engineer, now I is one"

 
Replies continue below

Recommended for you

In the following, I assume Column A has hours (as an integer), Column B has minutes (also as an integer), and Column C has seconds. Enter the following formula in Column D, and use one of Excel's standard built-in time formats:

=(A2*3600+B2*60+C2)/(24*3600)

What I am doing is combining the hours, minutes and seconds into total seconds, then dividing by the number of seconds in a day, to get fractions of a day. (Excel uses the integer part of a time / date code as representing the day number, and the fractional part as being the fraction of that date. (e.g. 0.25 is 6:00 am, 0.75 is 6:00 pm, and so on.)

Hope this helps.
 
Or you could just use the TIME(Hour,Minute,Second) function.

With hours as an integer in A1, minutes as an integer in B1 and seconds in C1 use :
[tt]=TIME(A1,B1,C1)[/tt]
wherever you want it.

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting
 
Doh!

Boy, do i feel stupid! I never knew that Excel had that "Time" function built right in - a bit simpler than writing your own code to do the same job!

Thanks, johnwm
 
Status
Not open for further replies.
Back
Top