Zero as a Duration

I have cells that calculate a duration with some cells showing something like "9h 52m" and some showing "0" when there is no duration. I get an error when I try to sum these cells that says all values need to be numbers or durations. How can I get my "0" cells to appear as durations?

MacBook Pro, Mac OS X (10.5.8)

Posted on Sep 4, 2010 7:43 AM

Reply
5 replies

Sep 6, 2010 4:44 AM in response to KOENIG Yvan

Interesting. This will work if the cell is a value. However, it won't work if the value is calculated from blank cells. I entered 3, 0, 7, in three cells and formatted them as duration. Summing the cells gives me 10, but if I make the 0 cell a calculation like subtracting two other empty time cells, then the subtraction calculation returns 0 (with no duration "h" displayed) and the sum calculation returns an error. This is common for me because my sheet might subtract two times from empty cells.

Sep 6, 2010 7:35 AM in response to David Benman1

My G5 running 10.5.8 died so I can't test the behavior under 10.5.8.

Under 10.6.4, if C2 and D2 contain the same duration value, the formula
=D2-C2 return 0h
so, I don't understand where is the problem.

0 inserted in a cell is a duration if the cell is defined this way.
Calculations upon durations return durations.

The unique case where it drops the duration format is when we make calculations with items of different formats.
if a cell multiply a currency value and the difference of two durations, the result is a pure number because the application has no means to guess if we want a currency result (which is the logical behavior for a human being) or if we want a duration result (which would be ridiculous).
It would be fine if Numbers was always behaving this way.
Try :

B2 : 10$
C2 : 12€
D2: 11£
On a system whose default currency is €,
=B2*C2 as bad as =C2*B2 will return 120€
=B2*D2 as bad as =D2*B2 will return 110€
=C2*D2 as bad as =D2*C2 will return 132€
On a system whose default currency is $, I guess that they will return 120$, 110$, 132$

All these results are ridiculous.

It would be fine if the engineers where fair enough to introduce consistency tests :

currency * currency is ridiculous
weight * weight is ridiculous
length * length is valid (it's a surface)
length * length * length is valid ( it's a volume)
currency/currency is valid it it doesn't apply a currency to the result but at this time, it apply one 😟

When my ten years old grand-son got an euro value when he divided two euros ones, he came saying "Papy, the machine became fool".

Yvan KOENIG (VALLAURIS, France) lundi 6 septembre 2010 16:35:40

Sep 6, 2010 6:10 PM in response to KOENIG Yvan

He is correct (at least on my Mac) that if you format two cells as date & time but put no values in them then subtract one from the other, the result is zero, not a duration of 0h, even with the destination cell pre-formatted as a duration. If the blank cells are formatted as "automatic", the result is also a 0, not 0h.

So, if the original poster is doing calculations on blank cells, it is possible that the result will not be a duration. Two solutions I can think of:

1) Pre-fill the blank cells with whatever it takes to make the result a duration.
or
2) Use a formula like =IF(ISERROR(DUR2HOURS(D3-E3)),DURATION(0),D3-E3)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Zero as a Duration

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.