calculate hours

C

Caveman

Hi
I have a spreadsheet formated custom hh:mm in cells A2:A6, A2 is th
start time (1am), A3 is a break (45mins) taken at 3.45am, A4 is a brea
(1hour) taken at 5.15am, A5 is my finish time 1445pm, I get extra £3.0
an hour for hours worked between 18:00 and 06:00. A6 is total hor
worked. I want another cell (A7) to show how many hours were worke
between 18:00 and 06:00. Calculation can show with breaks out o
included, or both.
Many Thanks
Cavema
 
F

Fred Smith

Try something like this:

a7 =min(a5,time(6,0,0))-if(a2<a5,a2,max(a2,time(18,0,0))-1)

This will calculate the total time worked between 18h00 and 6h00, including
breaks.

To subtract the breaks, you would deduct:

=if(and(a3>time(5,15,0),a3<time(6,0,0)),time(6,0,0)-a3,0)+if(and(a4>time(5,0,0),a4<time(6,0,0)),time(6,0,0)-a4,0)

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top