If then statement

Lionround

New Member
Joined
Jun 1, 2011
Messages
15
Excel 2007. I have created a timesheet that calculates the number of hours worked minus half hour for lunch. So if an employee comes in at 8:30 am and leaves at 5:00 pm, they are credited 8 hours.

However, if they work 4 hours or less, I need the formula to NOT deduct the half hour.

What I have thus far is:

=IF(COUNT(C13:D13)<2,"",MIN(8.5,MOD(D13-C13,1)*24)-0.5)

C13 is arrival time and D13 is departure time.

Suggestions?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
try something like this...

Code:
=IF(COUNT(C13:D13)<2,"",MIN(8.5,MOD(D13-C13,1)*24)[COLOR="Red"]-IF(MOD(D13-C13,1)*24>4,0.5,0)[/COLOR])
 
Upvote 0
Code:
=if(count(c13:d13)<2,"",if(mod(d13-c13,1)<4.1,min(8.5,mod(d13-c13,1)*24),min(8.5,mod(d13-c13,1)*24)-0.5))
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,239
Members
452,898
Latest member
Capolavoro009

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