Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Time Formulas

I am looking for the correct formula to express the
following example:

Start Time: 11:00PM - End Time: 7:00AM = 8 Total hours
worked. (or Xh & Xmm)

Everything I've looked at thus far won't calculate
anything that occurs before midnight properly.

Thank you in advance for your help!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Time Formulas

Since XL stores times as fractional days, 11:00 PM is stored as
23/24ths while 7:00 AM is stored as 7/24ths.

The trick is to add 1 (i.e., 24 hours) to the later time when the
span goes across midnight. One way is to use XL's conversion of a
boolean TRUE to 1 and FALSE to 0:

A1: 11:00 PM
A2: 7:00 AM
A3: =A2 - A1 + (A2<A1)

which will evaluate as

=7/24 - 23/24 + TRUE == 7/24 - 23/24 + 1 == 8/24

You can do this a little more compactly using MOD:

A3: =MOD(A2-A1,1)

In each case, you may need to format A3 as a time.

In article ,
"Bill Smithers" wrote:

I am looking for the correct formula to express the
following example:

Start Time: 11:00PM - End Time: 7:00AM = 8 Total hours
worked. (or Xh & Xmm)

Everything I've looked at thus far won't calculate
anything that occurs before midnight properly.

Thank you in advance for your help!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Time Formulas



J.E.M. ...

I can't thank you enough for responding to my question. I followed your
instructions and it all works perfectly both before & after midnight
times...

Best wishes to you and your family this Holiday Season!

Bill Smithers


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
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
time formulas vdmbqb Excel Discussion (Misc queries) 2 March 12th 10 03:41 AM
Time formulas Blazingsaddles Excel Worksheet Functions 15 October 9th 07 10:51 PM
Time formulas dj479794 Excel Discussion (Misc queries) 8 September 25th 07 10:33 PM
*HELP* time formulas Rookie Excel Worksheet Functions 3 July 9th 06 09:59 PM
Time formulas famdamly Excel Discussion (Misc queries) 1 March 1st 06 04:34 PM


All times are GMT +1. The time now is 04:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"