View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
PJF[_2_] PJF[_2_] is offline
external usenet poster
 
Posts: 12
Default how to calculate time in a payroll worksheet -- Shifts that cross midnight

If your shifts cross midnight, you can use the following formula in A3:
=IF(A2<A1,(1-A1)+A2,A2-A1).


"PJF" wrote in message
...
P.S. CAUTION: This will only work for shifts that do not cross midnight.

If
you have an 11 PM to 7 AM shift, this won't work. Will see if I can come

up
with a solution.


"PJF" wrote in message
...
Here's a crude way: Use 24-hour (Military) time to enter the start and

end
times. Be sure to insert a colon between hours and minutes. So, if an
employee works 7AM to 3:30 PM, the entries would be 7:00 and 15:30,
respectively. You can format the cells so that they display English

time,
i.e., 7:00 AM and 3:30 PM, respectively. So, if you put the start time

in
cell A1 and the end time in A2, you can use a simple subtraction formula

in
cell A3, formatting it as a simple number. It will display as a

decimal.
You must multiply the decimal by 24 in order to get a display of hours
worked.

So, the employee inserts :

08:00 in cell A1 and will display as 8:00 AM
15:30 in cell A2 and will display as 3:30 PM

The total time worked is then calculated in A3 by the formula:

=(A2-A1)*24
and will display as 7.5. If you'd rather retain a time display in A3
(7:30), change the format and delete the 24-hour multiplier.

Hope this helps.




"Peekabeaux" wrote in message
...
I am attempting to create a time card in which the user just types in

the
time they clock out and type in the time they clock out. At the end

of
the
day I want to total number of hours worked. But when I use a time

format,
and enter 8 for 8:00 a.m, the value shows 1/8/1900 at 12:00 a.m.. How

do
I
fix this so only the hours and minutes are shown and I can calculate

the
daily and weekly totals? I have tried downloading 2 different

templates
from
Microsoft, but still shows the date. Please help.
Oh yeah, while I'm asking :-), does anyone out there know how to

insert
a
cell value in a header. I want to apply this to a template.
Thanks,

Peek