LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default How to substract for lunch on =MOD function

jcc31 wrote...
I have this function to calculate a weekly total hours for a person.
This is for a 7 day week schedule.

=MOD(C4-B4,1)+MOD(E4-D4,1)+MOD(G4-F4,1)+MOD(I4-H4,1)+MOD(K4-J4,1)
+MOD(M4-L4,1)+MOD(O4-N4,1)

How can I substract 30 minutes for lunch per day that this person
works.. Keep in mind that this person will sometimes work 3 days of the
week and sometimes he/she will work 5 days of the week. The days of the
week will vary.


How are you sure they always take lunch or always take only 30 minutes
for lunch? If the difference between time-in and time-out is 3 hours or
less, would they have taken lunch? Better question: would you be in
compliance with labor laws in your location if you arbitrarily assume
they always take lunch no matter how few hours they may work? Where I
am, the fines the state would impose for such assumptions dwarf the
possible costs of providing employees paid lunch breaks. Before giving
another answer, I'd point out you'd be better off having these people
clock out at the beginning of their lunch breaks and clock back in at
the end of them, then calc hours worked as time worked from arrival to
lunch + time worked from lunch to departure.

You see to have time-in entries in cols B, D, F, etc., and time-out
entries in cols C, E, G, etc. You could get tricky and rewrite the
formula above as the array formula

=MMULT(--B4:O4,{-1;1;-1;1;-1;1;-1;1;-1;1;-1;1;-1;1})

The -- for the 1st argument is needed to convert blank cells into zeros
because MMULT is pathologically stupid about blank cells. Following the
matrix multiplication approach, the array formula

=SUM((MMULT(--B4:O4,({1;1;2;2;3;3;4;4;5;5;6;6;7;7}={1,2,3,4,5,6, 7})
*{-1;1;-1;1;-1;1;-1;1;-1;1;-1;1;-1;1})0)/48)

should give the lunch half hours for days worked (which presumably are
the days on which time-in and time-out are the same, blank). Net work
hours would then be given by the array formula

=MMULT(--B4:O4,{-1;1;-1;1;-1;1;-1;1;-1;1;-1;1;-1;1})-SUM((MMULT(--B4:O4,
({1;1;2;2;3;3;4;4;5;5;6;6;7;7}={1,2,3,4,5,6,7})*{-1;1;-1;1;-1;1;-1;1;-1;1;-1;1;-1;1})0)/48)

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Custom Excel Function to Calculate Gini Coefficients [email protected] Excel Worksheet Functions 3 February 21st 06 10:15 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
Formula to list unique values JaneC Excel Worksheet Functions 4 December 10th 04 12:25 AM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 04:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"