Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I calculate duration between two dates and times in excel? | Excel Discussion (Misc queries) | |||
formula to calculate difference between dates and times | Excel Discussion (Misc queries) | |||
calculate elapsed time between dates and times | Excel Worksheet Functions | |||
Subtracting dates to get hours... but I want to skip weekends | Excel Discussion (Misc queries) | |||
Formula to calculate elapsed time between certain dates and times | Excel Discussion (Misc queries) |