Subtract Time From Total Hours

Alan_P

Well-known Member
Joined
Jul 8, 2014
Messages
596
Hi Guys,

I'm trying to create what I (very mistakenly) thought would be a simple TimeSheet for my office... I basically have the below 3 variables:

ClockIn : 07:45 [Typed by user]
Current Time: 14:45:00 [using "=Now()"]
Hrs Worked: 07:00 [Simple subtraction of Current - ClockIn]

Now I want to take the Hrs Worked away from a weekly total of 35 hours and I just can't seem to get it to work! I've been googling like a madman and I just seem to be going round in circles so any help would be very much appreciated!!

I'm trying to do this in VBA but at this point I would gladly accept a formula, but ideally I would like to not have to format the cells (much)

Many Thanks,
Alan.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Alan Hi,

do you want the answer back as HH:MM or as a decimal (e.g. 32:43 (with seconds as well?) or 32.72, both of which would be 32 hours and 43 minutes)?


Ed
 
Upvote 0
Hi Ed,

Thanks for taking the time to have a look!

Preferably I would like it to be HH:MM:SS

Thanks,
Alan.
 
Upvote 0
Alan

assuming the 'Hrs remaining' is in cell B8 (e.g. 35 - 'Hours worked') then the formula you need to return the result as a string is

=TEXT(INT(B8),"00:") & TEXT(INT(MOD(B8,1)*60),"00:") & TEXT(INT((MOD(B8,1)-B11/60)*3600),"00")

(seems to work having run a few examples through it!)


Ed
 
Upvote 0
Now I want to take the Hrs Worked away from a weekly total of 35 hours

Hi, something like this? Custom format the cell that contains the formula as [hh]:mm


Excel 2013/2016
AB
1Clock In07:45
2Current Time10:32
3Hrs Worked02:47
4Hrs Remaining32:12
Sheet1
Cell Formulas
RangeFormula
B4="35:00"-B3
 
Upvote 0
Can't believe it was that simple!! Think I'd gone excel blind!

Thanks for the help guys, much appreciated!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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