time values in if formulas excel 2007

D sweetman

New Member
Joined
Nov 1, 2015
Messages
11
Hi
See below a start and finish time of a shift. For John Doe I want the hours worked to read 24:00. See formulas used in the 2 hours worked for John and Peter.

[TABLE="width: 426"]
<tbody>[TR]
[TD]Start[/TD]
[TD][/TD]
[TD]Finish[/TD]
[TD]Name[/TD]
[TD][/TD]
[TD]Hours worked[/TD]
[/TR]
[TR]
[TD]14:00[/TD]
[TD] Sleep over[/TD]
[TD]14:00[/TD]
[TD]John Doe[/TD]
[TD][/TD]
[TD]00:00[/TD]
[/TR]
[TR]
[TD]16:00[/TD]
[TD]D/D[/TD]
[TD]21:00[/TD]
[TD]Peter Doe[/TD]
[TD][/TD]
[TD]05:00[/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="width: 350"]
<tbody>[TR]
[TD]=IF(D3="";"";(IF((D3>B3);(D3-B3);(24-(B3-D3)))))

[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 350"]
<tbody>[TR]
[TD="class: xl65, width: 350"]=IF(D4="";"";(IF((D4>B4);(D4-B4);(24-(B4-D4)))))[/TD]
[/TR]
</tbody>[/TABLE]

Thanks for any help
Regards
David
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Do you mind the hours worked being decimal (rather than hours:mins)? If that's ok, just reformat the column as a number rather than as a time.
(Also the semicolons in the formula should be commas)
 
Upvote 0
Thanks
Yes ideally HH/MM and I tried commas but I got an error and no error when I used semi colons. Strange!!!
 
Upvote 0
try custom format [h]:mm that will display as 24:00
 
Upvote 0
I got [TABLE="width: 175"]
<tbody>[TR]
[TD]576:00
with that format?
Regards[/TD]
[/TR]
</tbody>[/TABLE]

which format

[TABLE="width: 320"]
<colgroup><col span="2" width="124"><col width="72"></colgroup><tbody>[TR]
[TD="class: xl63, width: 124, align: right"]31/10/2015 16:58[/TD]
[TD="class: xl63, width: 124, align: right"]01/11/2015 16:58[/TD]
[TD="class: xl64, width: 72, align: right"]24:00[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Thanks
Yes ideally HH/MM and I tried commas but I got an error and no error when I used semi colons. Strange!!!

delimiters, are a reflection of your system settings
 
Upvote 0
Hi
I got 576 instead of 24:00 and I formatted the cell [H]:mm
Also how do I change the delimiter back to a comma, it used to be a comma.
Regards
David
 
Upvote 0

Forum statistics

Threads
1,224,454
Messages
6,178,764
Members
452,874
Latest member
dasbach

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