[Solved] How to sum times expressed in HH:MM:SS

Discuss the spreadsheet application
Post Reply
User avatar
krige
Posts: 9
Joined: Sat Jun 28, 2008 2:43 pm
Location: Cosenza, Italy

[Solved] How to sum times expressed in HH:MM:SS

Post by krige »

What's the formula to know the total amount of time resulting from the sum of the times stored in cells in HH:MM:SS format?

For example: given a few cells containing 0:02:23, 1:50:01, 0:00:10

How do you get their total time in HH:MM:SS?
And how do you get their total time in seconds?
Last edited by Hagar Delest on Thu Apr 29, 2010 6:36 pm, edited 1 time in total.
Reason: tagged [Solved].
OOo 3.2 on Ubuntu 10.04
User avatar
Robert Tucker
Volunteer
Posts: 1250
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: How to sum times expressed in HH:MM:SS

Post by Robert Tucker »

If they are in A1, B1 and C1 then the sum is =SUM(A1:C1) with all cells formatted to time HH:MM:SS.

To convert to seconds multiply by 24*60*60.
LibreOffice 7.x.x on Arch and Fedora.
User avatar
krige
Posts: 9
Joined: Sat Jun 28, 2008 2:43 pm
Location: Cosenza, Italy

Re: How to sum times expressed in HH:MM:SS

Post by krige »

Robert Tucker wrote:If they are in A1, B1 and C1 then the sum is =SUM(A1:C1) with all cells formatted to time HH:MM:SS.

To convert to seconds multiply by 24*60*60.
That's the first thing I tried but didn't work, the result showed zero or some other weird result.

Now I see the problem was due to the content of cells: I don't know why, some of them contained a leading apostrophe. Removing the apostrophe fixed the problem.

Thank you very much :)
OOo 3.2 on Ubuntu 10.04
User avatar
Robert Tucker
Volunteer
Posts: 1250
Joined: Mon Oct 08, 2007 1:34 am
Location: Manchester UK

Re: [Solved] How to sum times expressed in HH:MM:SS

Post by Robert Tucker »

A leading apostrophe means the figures were entered as text.

I should possibly have explained, although it is now probably obvious, that time is stored as a number representing days and/or parts thereof.
LibreOffice 7.x.x on Arch and Fedora.
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] How to sum times expressed in HH:MM:SS

Post by Villeroy »

krige is Italian. Italian time format has points as in 12.34.56
12:34:56 is not recognized as a time in Italian locale context.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply