LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 538
Default Formula than understands midnight?

In my logs, I have a series of times entered into columns B through G, then
in H there is this formula:

=MAX(B1:G1)-MIN(B1:G1)

....which calculates the total time for the line. Simple, no?

No. Most days, there is an entry that spans midnight:

B C D E F G H
23:58 0:06 0:19 0:25 (blank) (blank) 23:52
23:48 23:54 (blank) (blank) 23:58 0:05 23:53
(blank)(blank) 23:35 0:04 (blank) (blank) 23:31

In case it's not obvious, H is wrong. (Should be 0:27, 0:17, 0:29.)

Right now, I simply manually enter one of these when an entry spans
midnight:

=1+(E1-B1)

....replacing B & E with whatever is appropriate (although those are the most
frequent).

I've tried a few different formulae to get this to happen automagically, but
none of them really work consistently, and I'm not really happy with any of
them. Most importantly: I don't know how to figure out which column is the
earliest time (i.e. 23:48) and which is the latest (i.e. 0:05) without
resorting to VBA, which I feel certain shouldn't be necessary for this.

Does anyone have a good solution for this?

If it matters...
- E and G are mutually exclusive; I won't have both on the same line.
- If F is non-blank, it will *always* be earlier than D, E, and G, and
*always* later than B (and B will *always* be non-blank). Could be
either way with C.

--
The way to handle back-seat drivers is to remove the back seat.
 
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
After midnight Steved Excel Worksheet Functions 3 December 12th 07 02:31 AM
Time after midnight Steved Excel Worksheet Functions 2 May 30th 07 08:10 PM
time around midnight Mai-Britt Excel Worksheet Functions 2 May 9th 07 01:05 PM
mod formula used with midnight S in AZ Excel Worksheet Functions 1 September 6th 06 09:31 PM
formula to calculate time difference crossing midnight ditorejax Excel Worksheet Functions 3 August 17th 06 04:46 PM


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