Difference between hours

mtagliaferri

Board Regular
Joined
Oct 27, 2004
Messages
143
Hello, I need to have the result also as negative on a date system set as 1900, for the difference between times, example 12:35 - 13:05 will return me a error, but I need to show a result as - 0:30 as weel as 13:05 - 12:35 as a result of 0:30
Is it possible?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
8,016
Office Version
  1. 365
Excel doesn't like negative times.

If you're just interested in the cosmetics (and won't be trying to add the values later), try:

Code:
=IF(A1<B1,"-","")&TEXT(ABS(A1-B1),"h:mm")
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,019
Interesting... though Excel does not like to format negative times, it seems to be ok with their values. So you can sum them and then apply Matt's logic again...<ul>[*]=IF(SUM(C1:C5) < 0,"-","") & TEXT(ABS(SUM(C1:C5)),"[hh]:mm")[/list]<sup>edit</sup> Note: C1:C5 are actual differences: A1-B1, not Matt's formula. So this would be like in a hidden "helper" column. <sub>/edit</sub>
 

Forum statistics

Threads
1,141,756
Messages
5,708,329
Members
421,565
Latest member
Lastadiego

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top