View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff
 
Posts: n/a
Default Need difference between two dates/times in hours

If you want to exclude any holidays you'll have to create a list of those
dates in some range of cells and then include that range as the 3 argument
in the Networkdays function:

J1 = 1/1/2005
J2 = 7/4/2005
J3 = 12/24/2005

=NETWORKDAYS(A1,B1,J1:J3.....................

Try this:

A1 = 4/4/2005 10:00 AM
B1 = 4/5/2005 2:30 PM

=(IF(NETWORKDAYS(A1,A1)=1,17/24-MOD(A1,1),0)+IF(NETWORKDAYS(B1,B1)=1,MOD(B1,1)-8/24,0)+IF(NETWORKDAYS(A1+1,B1-1)<1,0,NETWORKDAYS(A1+1,B1-1))*8/24)*24

Format the cell as GENERAL

Returns 13.5

Note: NETWORKDAYS requires the Analysis ToolPak addin be installed.

Biff

"ramsdesk" wrote in
message ...

Thanks for pointing it out..

It is in M/D/Y format. Let us have the dates as 4th & 5th of April in
2005. In this case, the hours will be 13.5 totally (7 hrs in 4th & 6.5
hrs in 5th).


--
ramsdesk
------------------------------------------------------------------------
ramsdesk's Profile:
http://www.excelforum.com/member.php...o&userid=15705
View this thread: http://www.excelforum.com/showthread...hreadid=535417