Adding and Calculating time on a timesheet

Niven

New Member
Joined
Aug 23, 2011
Messages
45
Hi,

I have a timesheet where the user enters start and end time for each day. The calculated cell below gives the difference between start and end time i.e. number of hours worked.

I want to split the hours worked into Normal Hours and Overtime Hours.

For Normal Hours I am using =IF(SUM(E28:I28)>40,"40","SUM(E28:I28)).
For Overtime Hours I am using =IF(SUM(E28:I28)>40,"SUM(E28:I28)-40","0")

The first calculation just gives the total hours, not 40 and the second calculation gives 0.

I seem to think it has to do with the format. Can I use another function or should I use vba code? What code will work?

Thanks.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I would create another cell that references the normal hours with formatting of 40:00:00 and then use that cell for the calculation. So if I put the "40:00:00" in G1, the formula would be this (assuming the time format '37:30:55' was used):

Code:
=IF(SUM(E28:I28)>G1,G1,SUM(E28:I28))

=IF(SUM(E28:I28)>G1,SUM(E28:I28)-G1,0)
 
Upvote 0

Forum statistics

Threads
1,216,581
Messages
6,131,541
Members
449,654
Latest member
andz

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