Subtracting times

redfour

New Member
Joined
Oct 31, 2005
Messages
2
Subtracting one time from another is not as straightforward as your tip suggests.

Subtracting 05:00hrs from 22:00hrs is simple, but subtract 22:00hrs from 05:00hrs!

Using the IF statement can get round this problem.

Assume cell B1 is to be deducted from A1 and the result to go in C1.

To overcome the problem you need to add 24hrs to the value of A1 if it is less than the value of B1.

The formula =IF(B1>A1,(A1+24-B1),A1-B1) solves the problem.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi redfour,

Is this a question or an answer?

To get the difference between two times, start time in A1 and end time in B1

=B1-A1+(A1>B1)

format as h:mm
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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