Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
BRO BRO is offline
external usenet poster
 
Posts: 3
Default Caluculate difference between two times

I am looking for a formula to calculate the difference between two times in
hours. I also want to exclude the time between 11 PM on Friday night and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default Caluculate difference between two times

assuming that neither of your start or end date/times will fall between 11 PM
Friday and 11 PM Sunday you can use this formula

=(NETWORKDAYS(A1+"1:00",B1+"1:00")-1+MOD(B1+"1:00",1)-MOD(A1+"1:00",1))*24

note: NETWORKDAYS is part of Analysis ToolPak. If you get #NAME! error with
the above then you need to install. Tools addins tick "Analysis ToolPak"

"BRO" wrote:

I am looking for a formula to calculate the difference between two times in
hours. I also want to exclude the time between 11 PM on Friday night and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO

  #3   Report Post  
Posted to microsoft.public.excel.misc
BRO BRO is offline
external usenet poster
 
Posts: 3
Default Caluculate difference between two times

The formula work great for most of my data, however on ocassion I do have
start times that fall between 11 PM on Friday and 11 PM on Sunday. The stop
date however will never fall in this time period.

Any ideas for these cases?
--
BRO


"daddylonglegs" wrote:

assuming that neither of your start or end date/times will fall between 11 PM
Friday and 11 PM Sunday you can use this formula

=(NETWORKDAYS(A1+"1:00",B1+"1:00")-1+MOD(B1+"1:00",1)-MOD(A1+"1:00",1))*24

note: NETWORKDAYS is part of Analysis ToolPak. If you get #NAME! error with
the above then you need to install. Tools addins tick "Analysis ToolPak"

"BRO" wrote:

I am looking for a formula to calculate the difference between two times in
hours. I also want to exclude the time between 11 PM on Friday night and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Caluculate difference between two times

Hi

Assuming you have the Analysis Toolpak loaded, ToolsAddinsAnalysis
Toolpak, then

=NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
If you want to exclude Holidays as well as weekends, then add the 3rd
parameter to Networkdays which can either be cell references holding a
list of holiday dates or a named range holding holiday dates

=NETWORKDAYS(A1,B1,$X$1:$X$9)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
where X1:X9 hold a list of holiday dates
--
Regards

Roger Govier


"BRO" wrote in message
...
I am looking for a formula to calculate the difference between two
times in
hours. I also want to exclude the time between 11 PM on Friday night
and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO



  #5   Report Post  
Posted to microsoft.public.excel.misc
BRO BRO is offline
external usenet poster
 
Posts: 3
Default Caluculate difference between two times

The formula worked great. Any suggestions for when the start date would fall
between 11 PM Friday night and 11 PM Sunday? On ocassion the start date
would fall in this time period but the stop date would not. On these
ocassion the total time would start from 11 PM Sunday night.

Thanks,
--
BRO


"Roger Govier" wrote:

Hi

Assuming you have the Analysis Toolpak loaded, ToolsAddinsAnalysis
Toolpak, then

=NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
If you want to exclude Holidays as well as weekends, then add the 3rd
parameter to Networkdays which can either be cell references holding a
list of holiday dates or a named range holding holiday dates

=NETWORKDAYS(A1,B1,$X$1:$X$9)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
where X1:X9 hold a list of holiday dates
--
Regards

Roger Govier


"BRO" wrote in message
...
I am looking for a formula to calculate the difference between two
times in
hours. I also want to exclude the time between 11 PM on Friday night
and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Caluculate difference between two times

Hi

I think the following will work, making use of a "helper cell". I used
A2.
In A2
=IF(OR(AND(WEEKDAY(A1,2)=5,MOD(A1,1)*24=23),
WEEKDAY(A1,2)5),DATE(YEAR(A1),
MONTH(A1),DAY(A1)+7-WEEKDAY(A1,2))+TIME(23,0,0),A1)

Then in cell to have the result
=IF(A1=A2,NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24),(B1-A2)*24)

--
Regards

Roger Govier


"BRO" wrote in message
...
The formula worked great. Any suggestions for when the start date
would fall
between 11 PM Friday night and 11 PM Sunday? On ocassion the start
date
would fall in this time period but the stop date would not. On these
ocassion the total time would start from 11 PM Sunday night.

Thanks,
--
BRO


"Roger Govier" wrote:

Hi

Assuming you have the Analysis Toolpak loaded, ToolsAddinsAnalysis
Toolpak, then

=NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
If you want to exclude Holidays as well as weekends, then add the 3rd
parameter to Networkdays which can either be cell references holding
a
list of holiday dates or a named range holding holiday dates

=NETWORKDAYS(A1,B1,$X$1:$X$9)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
where X1:X9 hold a list of holiday dates
--
Regards

Roger Govier


"BRO" wrote in message
...
I am looking for a formula to calculate the difference between two
times in
hours. I also want to exclude the time between 11 PM on Friday
night
and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default Caluculate difference between two times

Hello BRO

"however on ocassion I do have
start times that fall between 11 PM on Friday and 11 PM on Sunday. The stop
date however will never fall in this time period"

just amend my suggested formula to:

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

"Roger Govier" wrote:

Hi

I think the following will work, making use of a "helper cell". I used
A2.
In A2
=IF(OR(AND(WEEKDAY(A1,2)=5,MOD(A1,1)*24=23),
WEEKDAY(A1,2)5),DATE(YEAR(A1),
MONTH(A1),DAY(A1)+7-WEEKDAY(A1,2))+TIME(23,0,0),A1)

Then in cell to have the result
=IF(A1=A2,NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24),(B1-A2)*24)

--
Regards

Roger Govier


"BRO" wrote in message
...
The formula worked great. Any suggestions for when the start date
would fall
between 11 PM Friday night and 11 PM Sunday? On ocassion the start
date
would fall in this time period but the stop date would not. On these
ocassion the total time would start from 11 PM Sunday night.

Thanks,
--
BRO


"Roger Govier" wrote:

Hi

Assuming you have the Analysis Toolpak loaded, ToolsAddinsAnalysis
Toolpak, then

=NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
If you want to exclude Holidays as well as weekends, then add the 3rd
parameter to Networkdays which can either be cell references holding
a
list of holiday dates or a named range holding holiday dates

=NETWORKDAYS(A1,B1,$X$1:$X$9)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
where X1:X9 hold a list of holiday dates
--
Regards

Roger Govier


"BRO" wrote in message
...
I am looking for a formula to calculate the difference between two
times in
hours. I also want to exclude the time between 11 PM on Friday
night
and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 287
Default Caluculate difference between two times

Sorry, should be multiplied by 24 as per original...

=(NETWORKDAYS(A1+"1:00",B1+"1:00")-1+MOD(B1+"1:00",1)-NETWORKDAYS(A1+"1:00",A1+"1:00")*MOD(A1+"1:00",1)) *24


"daddylonglegs" wrote:

Hello BRO

"however on ocassion I do have
start times that fall between 11 PM on Friday and 11 PM on Sunday. The stop
date however will never fall in this time period"

just amend my suggested formula to:

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

"Roger Govier" wrote:

Hi

I think the following will work, making use of a "helper cell". I used
A2.
In A2
=IF(OR(AND(WEEKDAY(A1,2)=5,MOD(A1,1)*24=23),
WEEKDAY(A1,2)5),DATE(YEAR(A1),
MONTH(A1),DAY(A1)+7-WEEKDAY(A1,2))+TIME(23,0,0),A1)

Then in cell to have the result
=IF(A1=A2,NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24),(B1-A2)*24)

--
Regards

Roger Govier


"BRO" wrote in message
...
The formula worked great. Any suggestions for when the start date
would fall
between 11 PM Friday night and 11 PM Sunday? On ocassion the start
date
would fall in this time period but the stop date would not. On these
ocassion the total time would start from 11 PM Sunday night.

Thanks,
--
BRO


"Roger Govier" wrote:

Hi

Assuming you have the Analysis Toolpak loaded, ToolsAddinsAnalysis
Toolpak, then

=NETWORKDAYS(A1,B1)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
If you want to exclude Holidays as well as weekends, then add the 3rd
parameter to Networkdays which can either be cell references holding
a
list of holiday dates or a named range holding holiday dates

=NETWORKDAYS(A1,B1,$X$1:$X$9)*24-MOD(A1,1)*24-(24-MOD(B1,1)*24)
where X1:X9 hold a list of holiday dates
--
Regards

Roger Govier


"BRO" wrote in message
...
I am looking for a formula to calculate the difference between two
times in
hours. I also want to exclude the time between 11 PM on Friday
night
and 11
PM on Sunday night.

Example
Time 2: 1/23/07 8:31 (B1)
Time 1: 1/19/07 13:52 (A1)
Difference is 90.7 hrs
Excluding weekend hrs difference would be 42.7 hrs

--
BRO






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
Difference in two times over days SouthAfricanStan Excel Worksheet Functions 1 May 5th 06 07:08 AM
Calculate difference (mins) between 2 Times Max Excel Worksheet Functions 6 October 11th 05 07:50 AM
HOURS DIFFERENCE IN TIME BETWEEN DIFFERENT DATES AND TIMES tankerman Excel Worksheet Functions 1 September 13th 05 04:31 PM
Difference in Times bcbjork Excel Discussion (Misc queries) 6 August 27th 05 03:42 PM
Charting and analyzing Times' times data for trends Johnny Excel Discussion (Misc queries) 1 May 5th 05 01:36 AM


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