View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
BoniM BoniM is offline
external usenet poster
 
Posts: 353
Default Formula to give date and time

Fractions are way easier (not mention slightly more accurate) than the
decimals I've somehow gotten into the habit of using over the years...
Just one teeny thing with your formula, tho... If the start date/time is 1
pm, your formula returns 9 the next morning, instead of 5 pm.

=A2+IF(AND(HOUR(A2)<=13,MINUTE(A2)=0),1/6,IF(WEEKDAY(A2,2)=5,2,0)+5/6)

fixes that and is way better than my original - :-)

"Harlan Grove" wrote:

"Angela1979" wrote...
....
In Column A is a date and time 12/04/07 16:00
In column B I need to have a formula to add 4 hours to column B


Presumably you mean add 4 hours to column A.

. . . this formula needs to take in to account days and
times - 9am - 5pm Monday - Friday.

So I need 12/04/07 16:00
With formula of 9am-5pm would be 13/04/07 12:00


B2: =A2+IF(HOUR(A2)<13,1/6,IF(WEEKDAY(A2,2)=5,2,0)+5/6)