Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How do I calc the time difference in hh:mm for shift work?


Example of my data

Col A1 = 16:00 (4PM) in time format
Col B1 = 24:00 (midnight)
Col C is formula TEXT(B1-A1,"h:mm") = 8:00 hrs which is correct.

However, when I try to calculate from 24:00 (midnight) to 07:00 (7 AM )I get
a
#VALUE! error.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default How do I calc the time difference in hh:mm for shift work?

B should be larger than A, to avoid negative times, which Excel doesn't
represent very well.
One option is to use 0:00 instead of 24:00
Or include dates in the times.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"TomS" wrote in message
...

Example of my data

Col A1 = 16:00 (4PM) in time format
Col B1 = 24:00 (midnight)
Col C is formula TEXT(B1-A1,"h:mm") = 8:00 hrs which is correct.

However, when I try to calculate from 24:00 (midnight) to 07:00 (7 AM )I
get
a
#VALUE! error.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,389
Default How do I calc the time difference in hh:mm for shift work?

Why do you convert your result to text?

Use:
=mod(b1-a1,1) and format the result as h:mm

If you have to have the result as text, use:
=text(mod(b1-a1,1),"h:mm")

Regards,
Fred.

"TomS" wrote in message
...

Example of my data

Col A1 = 16:00 (4PM) in time format
Col B1 = 24:00 (midnight)
Col C is formula TEXT(B1-A1,"h:mm") = 8:00 hrs which is correct.

However, when I try to calculate from 24:00 (midnight) to 07:00 (7 AM )I
get
a
#VALUE! error.


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How do I calc the time difference in hh:mm for shift work?





=IF((OR(H10="",G10="")),0,IF((H10<G10),((H10-G10)*24)+24,(H10-G10)*24))

G10 is start time, H10 is stop time. Change to your start and stop
cell names.

Sorry, but 24 hour format is required here. There may be a 12 hr
format version I do not know about.
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,389
Default How do I calc the time difference in hh:mm for shift work?

Format of a cell is immaterial to its calculation. Formatting controls only
the display, not the way it's stored internally. Any formula that works with
time, will work with all formats of it.

In your response, you should indicate that you are converting time to
decimal hours. The result would need to be formatted as a number.


Regards,
Fred.
"Sum Ting Wong" <SumTingWong@thebarattheendoftheVenusianLightnigBo lt.org
wrote in message ...




=IF((OR(H10="",G10="")),0,IF((H10<G10),((H10-G10)*24)+24,(H10-G10)*24))

G10 is start time, H10 is stop time. Change to your start and stop
cell names.

Sorry, but 24 hour format is required here. There may be a 12 hr
format version I do not know about.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 63
Default How do I calc the time difference in hh:mm for shift work?

On Tue, 28 Apr 2009 08:03:27 -0600, "Fred Smith"
wrote:

Format of a cell is immaterial to its calculation.


Perhaps, but the code given is 24 hr explicit code, if you'll simply
look at the numbers used to perform the calculations.

Formatting controls only
the display, not the way it's stored internally.


It also becomes a data validator as it only allows data to be entered
into such a cell in a matching format.

Any formula that works with
time, will work with all formats of it.


OK

In your response, you should indicate that you are converting time to
decimal hours. The result would need to be formatted as a number.


Yes, the answer is a decimal version, but anyone that tracks time
segments in other than quarter hours is nuts to begin with, so I would
also limit input into the time fields to quarter hour break points.




Regards,
Fred.
"Sum Ting Wong" <SumTingWong@thebarattheendoftheVenusianLightnigBo lt.org
wrote in message ...




=IF((OR(H10="",G10="")),0,IF((H10<G10),((H10-G10)*24)+24,(H10-G10)*24))

G10 is start time, H10 is stop time. Change to your start and stop
cell names.

Sorry, but 24 hour format is required here. There may be a 12 hr
format version I do not know about.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default How do I calc the time difference in hh:mm for shift work?

Answers interspersed below.
--
David Biddulph

"Archimedes' Lever" wrote in message
...
On Tue, 28 Apr 2009 08:03:27 -0600, "Fred Smith"
wrote:

Format of a cell is immaterial to its calculation.


Perhaps, but the code given is 24 hr explicit code, if you'll simply
look at the numbers used to perform the calculations.


Whether the time is displayed in 12 hour or 24 hour format will make no
difference to the result of the calculation, as Fred said.

Formatting controls only
the display, not the way it's stored internally.


It also becomes a data validator as it only allows data to be entered
into such a cell in a matching format.


Data validation and cell display formatting are two distinct features in
Excel. You can't use cell display formatting to perform the data validation
function. A cell displayed in 24 hour format doesn't prevent anyone
entering time in 12 hour format, nor does it prevent time beyond 24 hours
being entered.

Any formula that works with
time, will work with all formats of it.


OK

In your response, you should indicate that you are converting time to
decimal hours. The result would need to be formatted as a number.


Yes, the answer is a decimal version, but anyone that tracks time
segments in other than quarter hours is nuts to begin with, so I would
also limit input into the time fields to quarter hour break points.

Regards,
Fred.
"Sum Ting Wong" <SumTingWong@thebarattheendoftheVenusianLightnigBo lt.org
wrote in message ...

=IF((OR(H10="",G10="")),0,IF((H10<G10),((H10-G10)*24)+24,(H10-G10)*24))

G10 is start time, H10 is stop time. Change to your start and stop
cell names.

Sorry, but 24 hour format is required here. There may be a 12 hr
format version I do not know about.



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
How do I create formula to calc difference in dates? dlcroswell Excel Discussion (Misc queries) 21 May 12th 10 10:45 PM
Calc minutes and seconds difference Coach Excel Worksheet Functions 15 September 24th 06 04:57 AM
Display minutes ONLY and calc difference tjsmags Excel Discussion (Misc queries) 8 August 29th 06 08:03 PM
Can excel calc the difference between 2 dates removing weekends? Adam Excel Discussion (Misc queries) 1 August 14th 06 06:50 AM
Percentage difference calc that knows the largest figure Mighty Magpie Excel Discussion (Misc queries) 3 November 10th 05 06:45 PM


All times are GMT +1. The time now is 08:38 AM.

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"