Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Calculate number of hours between dates and times excluding Weekends

Hi I need to calculate the number of hours between two dates and times
excluding weekends. I would assume this requires a VB code but not too
familar with it, can anyone help.

For .e.g:

Start Date: - 23/10/06 12:30
End Date: - 25/10/06 11:30

The code should calculate if the difference is 24 hours or more and
display a message Exceeded or if it is less say not exceeded but if it
has crossed over the weekend then say, Weekend.

Can anyon please help!!!

Thanks
Princy

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 623
Default Calculate number of hours between dates and times excluding Weekends

Your requirements contradict each other. So let's deal with one at a time.

If your start date/time is in A1, and your end time is in A2, the number of
hours difference is:

=(a2-a1)*24 [format as a number]

As there are 24 hours in a day, you can also simply check to see if the
difference is more than one day.

So your if statement might look something like:

=if(a2-a11,"Exceeded","Not Exceeded")

With respect to weekends, how can you exclude weekends in the calculation, but
then need to know if you've crossed into a weekend? We need at better definition
of what you consider a weekend. For example,

-- is it a time period of 48 hours?
-- does it start at, say, 6pm on Friday?
-- does it end at, say, 8am on Monday?


--
Regards,
Fred


wrote in message
oups.com...
Hi I need to calculate the number of hours between two dates and times
excluding weekends. I would assume this requires a VB code but not too
familar with it, can anyone help.

For .e.g:

Start Date: - 23/10/06 12:30
End Date: - 25/10/06 11:30

The code should calculate if the difference is 24 hours or more and
display a message Exceeded or if it is less say not exceeded but if it
has crossed over the weekend then say, Weekend.

Can anyon please help!!!

Thanks
Princy



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 calculate duration between two dates and times in excel? Robin CSM002 Excel Discussion (Misc queries) 3 May 13th 23 07:42 PM
formula to calculate difference between dates and times Breezie Excel Discussion (Misc queries) 2 February 25th 06 04:14 PM
calculate elapsed time between dates and times Jenna Excel Worksheet Functions 2 January 25th 06 04:39 PM
Subtracting dates to get hours... but I want to skip weekends shadestreet Excel Discussion (Misc queries) 2 October 5th 05 06:20 PM
Formula to calculate elapsed time between certain dates and times Stadinx Excel Discussion (Misc queries) 6 March 25th 05 07:02 AM


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