Showing the negative value of time. EX: 07:04:00 becomes -07:04:00

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
705
Office Version
  1. 365
Platform
  1. Windows
Columns A and B show times. B-A could be positive or negative so I do this to get the difference: =IF(B2>A2,(B2-A2),(A2-B2)) This always gives me the difference in minutes because it always subtracts the larger number from the smaller one. You get ######### if you subtract a larger time from a smaller one. What I need though is to show the negative number if A is greater then B. How can I get the A2-B2 part of this formula to show -HH:MM:SS?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
And changing the format to -HH:MM:SS (with a - in front) changes the number to appear negative on the screen but when added to other numbers it's treated as a positive number.
 
Upvote 0
Sadly you are correct and it can't be done.
All the options are pretty ugly.
The below link shows the 2 standard alternatives and then lots of people commenting with other things they have tried.
Displaying Negative Times

If you want to be able to do sum, average and other calculations on the difference you are probably best off just formatting the column as a number and either *24 changing the heading to hours or *24*60 changing the heading to minutes.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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
Back
Top