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 TugboatEng on being selected by the Eng-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
Joined
Sep 8, 2003
Messages
16
Location
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"

 
roughly speaking, turn it into seconds since midnight, then format that cell as 'time'

It isn't quite as simple as that in practice!



Cheers

Greg Locock
 
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.

Part and Inventory Search

Sponsor

Back
Top