#1   Report Post  
Robyn Bellanger
 
Posts: n/a
Default Date formula

Hi,

I am trying to put together a formula that will calculate a cell referencing
a date less 30 days but to return a Friday date if it falls on Saturday and
a Monday date if it falls on Sunday.

Example:

B2= 01/10/05

=b2-30 returns a date of 12/11/04 which is on Saturday. I want it to return
12/10/04 Friday instead. If it fell on Sunday I would want it to return
Monday's date. Otherwise, if b2-30 falls on Monday through Friday I want
that date returned.

Any help would be greatly appreciated.


  #2   Report Post  
tjtjjtjt
 
Posts: n/a
Default

This should work:
=IF(WEEKDAY(B2-30,1)=1,B2-29,IF(WEEKDAY(B2-30,1)=7,B2-31,A2-30))

tj

"Robyn Bellanger" wrote:

Hi,

I am trying to put together a formula that will calculate a cell referencing
a date less 30 days but to return a Friday date if it falls on Saturday and
a Monday date if it falls on Sunday.

Example:

B2= 01/10/05

=b2-30 returns a date of 12/11/04 which is on Saturday. I want it to return
12/10/04 Friday instead. If it fell on Sunday I would want it to return
Monday's date. Otherwise, if b2-30 falls on Monday through Friday I want
that date returned.

Any help would be greatly appreciated.



  #3   Report Post  
tjtjjtjt
 
Posts: n/a
Default

Typo correction:
=IF(WEEKDAY(B2-30,1)=1,B2-29,IF(WEEKDAY(B2-30,1)=7,B2-31,B2-30))

I mistyped and had A2 at the end of the formula instead of B2.

tj


"tjtjjtjt" wrote:

This should work:
=IF(WEEKDAY(B2-30,1)=1,B2-29,IF(WEEKDAY(B2-30,1)=7,B2-31,A2-30))

tj

"Robyn Bellanger" wrote:

Hi,

I am trying to put together a formula that will calculate a cell referencing
a date less 30 days but to return a Friday date if it falls on Saturday and
a Monday date if it falls on Sunday.

Example:

B2= 01/10/05

=b2-30 returns a date of 12/11/04 which is on Saturday. I want it to return
12/10/04 Friday instead. If it fell on Sunday I would want it to return
Monday's date. Otherwise, if b2-30 falls on Monday through Friday I want
that date returned.

Any help would be greatly appreciated.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date updates from worksheet to chart & changes date to a date series! Help!! Jayjg Charts and Charting in Excel 2 January 22nd 05 03:00 PM
Converting an Excel formula to an Access query formula Adam Excel Discussion (Misc queries) 1 December 15th 04 03:38 AM
How do I add a date formula to a cell but hide the contents with . Emzy Wemzy Excel Discussion (Misc queries) 2 December 12th 04 01:48 PM
In Excel, I need a date math formula... Lisa Excel Discussion (Misc queries) 2 December 3rd 04 12:13 AM
How can I create formula that turns a date into the week # in don Excel Discussion (Misc queries) 0 November 28th 04 09:21 PM


All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"