Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default Calculating time interval (some across midnight)

I need to calculate two columns of time. Most entries fall within the
same day's 24 hour limit, so a simple forumla "=b1-a1" will do. But a
few in the 2nd column will cross midnight.

I could only find tips on formatting the result of such substracting in
the Excel Help file. The example used falls within the same day.

The example used in the Help file has both the date AND the time in the
same cell: "mm/dd/yy hh:mm." In both columns of mine, the time is
formatted as "hh:mm:ss" only. So I changed an entry to the same format
used in the Help file, which didn't seem to make a difference.

Thanks in advance,
Adam T.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
 
Posts: n/a
Default Calculating time interval (some across midnight)

Since XL stores times as fractional days, adding 1 to the later time
will allow correct interval calculation when the interval spans
midnight. One way to do that is to use XL's internal coercion of
TRUE/FALSE values to 1/0 respectively in math operations:

A1: start time
B1: end time
C1: =B1 - A1 + (B1<A1)

an equivalent method is to use the MOD() function:

C1: =MOD(B1-A1,1)

In article .com,
wrote:

I need to calculate two columns of time. Most entries fall within the
same day's 24 hour limit, so a simple forumla "=b1-a1" will do. But a
few in the 2nd column will cross midnight.

I could only find tips on formatting the result of such substracting in
the Excel Help file. The example used falls within the same day.

The example used in the Help file has both the date AND the time in the
same cell: "mm/dd/yy hh:mm." In both columns of mine, the time is
formatted as "hh:mm:ss" only. So I changed an entry to the same format
used in the Help file, which didn't seem to make a difference.

Thanks in advance,
Adam T.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default Calculating time interval (some across midnight)

JE:

Thank you for your quick response. I applied your method and it appears
to fix the problem!

Adam.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SVC
 
Posts: n/a
Default Calculating time interval (some across midnight)

If cell A1 is your starting time, cell B1 is your ending time, try this
formula in cell C1: =IF(A1B1, B1-A1+24, B1-A1)

" wrote:

I need to calculate two columns of time. Most entries fall within the
same day's 24 hour limit, so a simple forumla "=b1-a1" will do. But a
few in the 2nd column will cross midnight.

I could only find tips on formatting the result of such substracting in
the Excel Help file. The example used falls within the same day.

The example used in the Help file has both the date AND the time in the
same cell: "mm/dd/yy hh:mm." In both columns of mine, the time is
formatted as "hh:mm:ss" only. So I changed an entry to the same format
used in the Help file, which didn't seem to make a difference.

Thanks in advance,
Adam T.


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
Cells with time format and calculating the diffrence MikeR-Oz New Users to Excel 11 January 3rd 06 10:11 AM
Calculating Clock start time in Excel Hani Muhtadi Excel Discussion (Misc queries) 1 August 31st 05 10:01 PM
convert interval to various separate date , time, hr, minutes Todd F. Excel Worksheet Functions 4 July 12th 05 07:25 PM
I need help with a formula calculating time Mark Excel Discussion (Misc queries) 2 April 27th 05 10:31 AM
calculating with a time format cell Mahnaz Excel Worksheet Functions 1 December 13th 04 10:21 AM


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