Thread: Calculate Date
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Calculate Date

On Thu, 3 Mar 2005 08:43:07 -0800, Jerome
wrote:

I am trying to create a formula that will take a specific date in a cell and
give the date 35 days prior. I am only concerned with Mon-Fri. So, if the
date falls on a Saturday then give the Friday date. If the date falls on a
Sunday, then give the Monday date. I am not sure where to begin. I wrote
the following function of "= A2 - 32" Any help is greatly appreciated.


If I understand you correctly, you first want to subtract 35 days from the
particular date, and then change it only if that date falls on a weekend.

The function "=A2-32" will give you a date 32 days prior, not 35.

For a day 35 days prior, altered as you instruct if the day falls on a weekend,
use:

=A2-35+CHOOSE(WEEKDAY(A2-35),1,0,0,0,0,0,-1)

If, on the other hand, you are looking for 35 working days prior to the date in
A2, so that no weekends are even counted, then look at the WORKDAY function.


--ron