Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default difference of date/time only calculating workingdays/hours

Can you please help me. I need to calculate the difference between two dates
which also contain the timestamp but I would like it to only count the normal
working time - 8 hours per day and not weekends
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default difference of date/time only calculating workingdays/hours

Susanne,

Try this. It assumes you working day is 08:00 - 16:00 hrs so change to suit.
Format
the cell as [hh]:mm

Holidays is a named range that contains holiday dates. If you don't want
this simply delete ',holidays' form the formula

=(NETWORKDAYS(A1,B1,Holidays)-1)*("16:00"-"08:00")+MOD(B1,1)-MOD(A1,1)

Mike


"Susanne" wrote:

Can you please help me. I need to calculate the difference between two dates
which also contain the timestamp but I would like it to only count the normal
working time - 8 hours per day and not weekends

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,420
Default difference of date/time only calculating workingdays/hours

What if A1 or B1 is a weekend date, or a holiday?

Or the time is outside of those working hours?

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Susanne,

Try this. It assumes you working day is 08:00 - 16:00 hrs so change to
suit.
Format
the cell as [hh]:mm

Holidays is a named range that contains holiday dates. If you don't want
this simply delete ',holidays' form the formula

=(NETWORKDAYS(A1,B1,Holidays)-1)*("16:00"-"08:00")+MOD(B1,1)-MOD(A1,1)

Mike


"Susanne" wrote:

Can you please help me. I need to calculate the difference between two
dates
which also contain the timestamp but I would like it to only count the
normal
working time - 8 hours per day and not weekends



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default difference of date/time only calculating workingdays/hours

Bob,

I see your pont about the times, I assumed that the OP's times would be
within the working day and perhaps I should have pointed that out. I can't
see the issue with A1 or B1 being a weekend date

03/01/2009 08:00 05/01/2009 12:00

The formula evaluates as 4 for these 2 date/time for examples. What am I
missing?

Mike



"Bob Phillips" wrote:

What if A1 or B1 is a weekend date, or a holiday?

Or the time is outside of those working hours?

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Susanne,

Try this. It assumes you working day is 08:00 - 16:00 hrs so change to
suit.
Format
the cell as [hh]:mm

Holidays is a named range that contains holiday dates. If you don't want
this simply delete ',holidays' form the formula

=(NETWORKDAYS(A1,B1,Holidays)-1)*("16:00"-"08:00")+MOD(B1,1)-MOD(A1,1)

Mike


"Susanne" wrote:

Can you please help me. I need to calculate the difference between two
dates
which also contain the timestamp but I would like it to only count the
normal
working time - 8 hours per day and not weekends




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default difference of date/time only calculating workingdays/hours

Bob,

I'll answer my own question about what I'm missing. I'm missing the fact
that there are too many instances when my previous effort falls over.
Incidentally I've posted that lots of times and nobody pointed out the
problem. Is this one better? To keep it shorter the start/End times are
referenced in C1 - C2

=(NETWORKDAYS(A1,B1)-1)*(C2-C1)+IF(NETWORKDAYS(B1,B1),MEDIAN(MOD(B1,1),C2,C2), C2)-MEDIAN(NETWORKDAYS(A1,A1)*MOD(A1,1),C2,C1)

Thanks for the feedback and here's hoping for this one.

Mike

"Mike H" wrote:

Bob,

I see your pont about the times, I assumed that the OP's times would be
within the working day and perhaps I should have pointed that out. I can't
see the issue with A1 or B1 being a weekend date

03/01/2009 08:00 05/01/2009 12:00

The formula evaluates as 4 for these 2 date/time for examples. What am I
missing?

Mike



"Bob Phillips" wrote:

What if A1 or B1 is a weekend date, or a holiday?

Or the time is outside of those working hours?

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Susanne,

Try this. It assumes you working day is 08:00 - 16:00 hrs so change to
suit.
Format
the cell as [hh]:mm

Holidays is a named range that contains holiday dates. If you don't want
this simply delete ',holidays' form the formula

=(NETWORKDAYS(A1,B1,Holidays)-1)*("16:00"-"08:00")+MOD(B1,1)-MOD(A1,1)

Mike


"Susanne" wrote:

Can you please help me. I need to calculate the difference between two
dates
which also contain the timestamp but I would like it to only count the
normal
working time - 8 hours per day and not weekends




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 difference from 24 hours The Incredible Excel Discussion (Misc queries) 3 October 17th 08 01:20 PM
Calculating the difference between hours Oliver Excel Worksheet Functions 1 June 1st 08 07:48 PM
Difference of time in hours or minutes Charles Excel Discussion (Misc queries) 2 September 13th 06 11:12 PM
Calculating Difference Between Start Date & Time And End Date & Ti Samwar Excel Discussion (Misc queries) 2 December 19th 05 12:42 PM
calculate difference in time to hours Chris Excel Worksheet Functions 5 January 18th 05 06:07 PM


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