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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Negative Time 1

Status
Not open for further replies.

shadowfather

Technical User
May 20, 2005
5
GB
Hi,

I have a spreadsheet that subtracts a time in H:M:S from another time H:M:S. The problems start when I get a negative time it just shows #####. Can I get a negative time to show?
 
It needs to be formatted as [h]:mm:ss

You won't get an answer unless you change the calculation system to 1904 (in Tools->Options->Calculation).

Then it works - I built a flex balance calculation system around this a few years back.


Cheers,
Dave

Probably the only Test Analyst Manager on Tek-Tips...therefore whatever it was that went wrong, I'm to blame...

animadverto vos in Abyssus!

Take a look at Forum1393!
 
A cheap workaround, if you don't need the result to be an actual time value, is to do something like this:

Code:
=IF(A1>B1,A1-B1,"(" & TEXT(A1-B1,"[h]:mm")&")")

where A1 and B1 contain start and end times, respectively. In the event of a negative result, we reverse the subtraction order and display parentheses (or you could use a - instead) to denote negativity. Obviously, you won't be able to perform subsequent calculations on this difference.
 

Dave,

So YOU'RE the one we have to blame for this 1900 system NOT working so well, eh?
[sub]Should'v known -- suspected him all along -- mumble grumble hrump grrrrrr.......[/sub]

Skip,
[sub]
[glasses] [red]Be advised:[/red]To be safe on the FOURTH, don't take a FIFTH on the THIRD, or...
You might not come FORTH on the FIFTH! [bomb][tongue][/sub]
 
Skip,

Yep. Gotta keep it interesting... [smile]

Cheers,
Dave

Probably the only Test Analyst Manager on Tek-Tips...therefore whatever it was that went wrong, I'm to blame...

animadverto vos in Abyssus!

Take a look at Forum1393!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top