calculating difference in time formula

hotdogs1999

Board Regular
Joined
Dec 11, 2018
Messages
57
hello,

looking to calculate the difference in time for 2 cells, and then reducing that total by the time in a 3rd cell.

e.g cell B4 is '7.30' and B5 is '17.30' and cell B6 is '0.30'

i want to find the difference between B4 and B5, and then remove the B6 value off that total.

fyi time format is hour.minute (don't need seconds in the format)

Thanks in advance
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try

=MOD(B5-B4,1)-B6

MOD is not strictly necessary but it will prevent errors when times cross midnight.
 
Upvote 0
thanks.
times won't ever go over midnight so that won't matter

your formulas coming up with a random value

number format for B5 and B4 is 'Time', and B6 is 'Number' - if that affects how the formula works?
 
Upvote 0
I thought that it was a typo in your post, 7.30 17.30 and 0.30 are not times, 7:30 17:30 and 0:30 are times (see the difference?).

7.30 formatted as time is 7 days 7 hours and 12 minutes, mixed formatting is asking for trouble all cells need to be the same format.
 
Upvote 0
yip i notice that. only problem is you can't enter 30 mins as a time, as entering 0:30 changes it to 12:30am which is a time not a 'period of time'
 
Upvote 0
Not if you format as 24 hour. Table below uses standard 24 hr time format of hh:mm, you can change that to h:mm for A6 if you want to drop the first zero.

Book2
A
407:30
517:30
600:30
709:30
Sheet6
Cell Formulas
RangeFormula
A7A7=MOD(A5-A4,1)-A6
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,887
Members
449,057
Latest member
Moo4247

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