converting hh/mm/ss to seconds


Posted by Chris on January 22, 2002 9:12 PM

Can anyone help with a macro to do the above calculations? I need to take values from one column in the standard format eg. 9:25:45 being 9 hours 25 minutes and 45 seconds, and have cells in another column show the time converted to bulk seconds. It has to take account of some times being shorter than others, eg 12:20 being 12 minutes 20 seconds.



Posted by Tom Urtis on January 22, 2002 11:56 PM

There might be a simple approach if I understand you correctly. Let's say you have a time in A2 such as your example, 9:25:45. In B2 you could enter the formula =A2, and format B2 as [ss], which will return the number 33945, which is how many seconds are in 9 hours + 25 minutes + 45 seconds. Same as your other example, 12:20, which in format hh:mm:ss is 12 minutes and 20 seconds...that would be 740 seconds if the cell were formatted as [ss].

Did I guess correctly on what you are after?? If not, sorry, please repost.

Tom Urtis