Add 4 hours (only if between 9am-5pm)

A

Angela1979

Hi all,

I post a message earlier but it seems to have been removed.

Here goes again....

In column A I have a date and time.
I need a formula that will add 4 hours to the date and time, but take
into account working hours and weekends

Monday - Friday 9am - 5pm

Example
Column A
12/04/07 16:00

Column B
Formula for + 4 hours (taking into account Monday-Friday 9am - 5pm)

So the result in column B should be 12pm 13/04/07

Thanks Everyone
 
B

Bernie Deitrick

Angela,

For a date time in cell A2:

=A2+IF((A2-INT(A2)+4/24)*24> 17,IF(WEEKDAY(A2,2)=5,2,0)+20/24,4/24)

HTH,
Bernie
MS Excel MVP
 
G

Guest

=IF(AND(HOUR(A2)>=13,MINUTE(A2)>0),IF(WEEKDAY(A2)=6,A2+2.833333,A2+0.833333),A2+0.166667)

Checks to see if it's after 1 PM, if it is, checks to see if it's friday, if
it is friday, adds 2 days and 20 hours (time from close to open, plus four) -
if it's not friday, but is after 1, just adds 20 hours, if none of the above,
adds 4 hours.
This formula assumes that the date/time in column A will always be a workday
and in working hours.
 
D

David McRitchie

Your original question is out there and was posted 20 minutes
before you repeating question. You need a little more patience.
There can be a long
delay if you do not connect directly to the Microsoft news servers.
If you look at your message headers you will see a very long
PATH with exclamation points between each hop to another
server.
http://www.mvps.org/dmcritchie/excel/xlnews.htm#xlgroups

If you lose track of a question you can search newsgroups
based on your email address
http://groups.google.com/advanced_group_search
http://www.mvps.org/dmcritchie/excel/xlnews.htm#search

I think you can answer your question with a little help
from either of these web pages.
http://www.mvps.org/dmcritchie/excel/datetime.htm
http://www.cpearson.com/excel/datetime.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top