ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Adding or combining time problem. (https://www.excelbanter.com/excel-worksheet-functions/83450-adding-combining-time-problem.html)

purtech

Adding or combining time problem.
 
I am trying to simply add times h:mm format.

=TEXT(F22-"37:30","h:mm")
=TEXT(F49-"37:30","h:mm")

These can and do give negative results because I am using the 1904 date
system.
But, if I try to sum the result of these two if any have a negative result I
get an error. I am using the below for the sum:

=F23+F50 all h:mm

So how do I add values when one is negative? Or is there another way?

Thanks!








Biff

Adding or combining time problem.
 
Hi!

Why are you using the TEXT function?

This is one of those "quirky" things where I can't explain why it works the
way it does, I just know that it works the way it does!

The minus sign in a negative (TEXT) value can't be coerced into a numeric
negative so the value remains a TEXT value. When both values are positive
the act of adding them together:

value1 + value2

coerces them into numeric numbers. If you tried using =SUM(value1,value2),
that would return 0 since both values are TEXT and SUM ignores text.

If you try to coerce -value1 using the unary operator it still errors
because -value1 is a TEXT value.

So, why are you using the TEXT function? Why not just: cell_ref-"37:30"

Then =F23+F50 will work.

Biff

"purtech" wrote in message
...
I am trying to simply add times h:mm format.

=TEXT(F22-"37:30","h:mm")
=TEXT(F49-"37:30","h:mm")

These can and do give negative results because I am using the 1904 date
system.
But, if I try to sum the result of these two if any have a negative result
I
get an error. I am using the below for the sum:

=F23+F50 all h:mm

So how do I add values when one is negative? Or is there another way?

Thanks!











All times are GMT +1. The time now is 01:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com