Thread: IF Statement
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default IF Statement

The Excel way to do this (on the worksheet itself) would be to make use of
the Analysis ToolPak add-in...

=WORKDAY(A1,2)

This function also allows you to account for holidays via an optional 3rd
argument. But you said you wanted to be able to use the solution in Word
also... this means you want a VB solution. If the date you are adding your 2
"business" days to will never be a Saturday, you can use this statement...

Add2BusinessDays = DateIn + 2 - 2 * ((Weekday(DateIn) = 5) +
(Weekday(DateIn) = 6))

and if your date could be a Saturday, then you can use this statement
instead...

Add2BusinessDays = DateIn + 2 - 2 * ((Weekday(DateIn) = 5) +
(Weekday(DateIn) = 6) + 3 * (Weekday(DateIn) = 7))

Note: Your newsreader will surely word wrap those statements, but each one
should be on a single line.

--
Rick (MVP - Excel)


"Tech Support" wrote in message
...
Hi people quick quest been a long time since i done this kind of thing

How would i program a excel docuement to say if it is the 1st then ad 2
days
and so on to go through the week but if it is a friday then i need to add
4
to miss out the weekend. really it would be good if the if statement would
work in MS Word.