View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default work hours with different hour prices

Hi Diogo,

Am Tue, 28 Jan 2014 18:27:35 -0800 (PST) schrieb
:

For example...
I go to work at 6am and leave at 23h. As my payments are different depending of my shift i need to know how many hours i worked between 7 to 22 and how many i worked from 22 to 7.


start time in A2, end time in B2

Then for hours between 7:00 and 22:00 in C2:
=IF(B2A2,MIN(B2,TIME(22,,))-MAX(A2,TIME(7,,)),MAX(TIME(22,,)-A2,0)+MAX(B2-TIME(7,,),0))

and for hours between 22:00 and 7:00 in D2:
=MOD(B2-A2,1)-C2


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2