LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Biff
 
Posts: n/a
Default

Discovered a bug.....

Try this:

=IF(B1="","",IF(DAY(B1)=DAY(A1),MOD(B1,1)-MAX(MOD(A1,1),22/24),IF(MOD(A1,1)<MOD(B1,1),MIN(MIN(MOD(B1,1),6/24)-MOD(A1,1),6/24),IF(MOD(A1,1)<22/24,2/24+MIN(MOD(B1,1),6/24),1-MOD(A1,1)+MIN(MOD(B1,1),6/24))))*24)

Biff

"Biff" wrote in message
...
Hi!

Slightly shorter....

A1 = Date/Time in
B1 = Date/Time out

=IF(B1="","",IF(MOD(A1,1)<MOD(B1,1),MIN(MIN(MOD(B1 ,1),6/24)-MOD(A1,1),6/24),IF(MOD(A1,1)<22/24,2/24+MIN(MOD(B1,1),6/24),1-MOD(A1,1)+MIN(MOD(B1,1),6/24)))*24)

Note: Discovered rounding discrepancies during testing but they do not
effect the correctness of the results. For example:

A1 = 8/7/2005 10:00 PM

=MOD(A1,1) = 0.91666666666424100000

The time value: 10:00 PM is equivalent to 22/24 as used in the formula.
However:

22/24 = 0.91666666666666700000

Biff

"HappyTrucker"
wrote in message
...

OK, I think I've sorted it. Well it seems to work anyway. I don't know
whether I stumped you all, or it just wasn't clear enough. Or maybe the
problem wasn't interesting enough. Anyway, if anyone's interested,
here's what I came up with eventually. And my God is it a loooong one:

=IF(B15="","",IF(AND((B14<(LEFT(B14,5)+"22:00")),( B15<=(LEFT(B15,5)+"06:00"))),((B15-(LEFT(B14,5)+"22:00"))*24),IF(AND((B14=(LEFT(B14, 5)+"22:00")),
(B15<=(LEFT(B15,5)+"06:00"))),(B15-B14)*24,IF(AND((B14(LEFT(B14,5)+"22:00")),(B15=( LEFT(B15,5)+"06:00"))),(((LEFT(B15,5)+"06:00")-B14)*24),8))))




--
HappyTrucker
------------------------------------------------------------------------
HappyTrucker's Profile:
http://www.excelforum.com/member.php...o&userid=25997
View this thread:
http://www.excelforum.com/showthread...hreadid=393601







 
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
Adding hours and minutes Patrick Excel Worksheet Functions 16 June 18th 08 09:24 PM
creating a formula for a timecard obiding by CA OT laws ness Excel Worksheet Functions 4 May 26th 05 07:51 PM
Need a function that separates over-lapping work shift hours. Katybug1964 Excel Worksheet Functions 0 May 24th 05 03:32 PM
calculate difference in time to hours Chris Excel Worksheet Functions 5 January 18th 05 06:07 PM
need help w/formula for calculating overtime hours jv749297 Excel Worksheet Functions 1 January 17th 05 07:54 PM


All times are GMT +1. The time now is 05:45 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"