Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Fernando
 
Posts: n/a
Default Subtract # of days from date, but if not sat, goto previous sat?

Need to calculate dates by subtracting a certain number of days, but if it is
not a particular day of the week, it needs to go back to the previous week
and give me the date of that particular day of the week.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Tom Ogilvy
 
Posts: n/a
Default Subtract # of days from date, but if not sat, goto previous sat?

something like:

=IF(WEEKDAY(TODAY()-B9,1) =
3,TODAY()-B9,TODAY()-B9-(WEEKDAY(TODAY()-B9))-(7-3))

B9 contains the number of days to subtract
Where 3 represents Tuesday. Change to suit.

--
Regards,
Tom Ogilvy


"Fernando" wrote:

Need to calculate dates by subtracting a certain number of days, but if it is
not a particular day of the week, it needs to go back to the previous week
and give me the date of that particular day of the week.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Fernando
 
Posts: n/a
Default Subtract # of days from date, but if not sat, goto previous sa

Tom,
The formula works, but in some cases it would go back an extra week. For
example I have to go back 28 days from 10/10/06 and make sure that it is a
Sunday. If you subtract 28 days to Oct 10, you end up at Tue Sept 12th. If
you have to go back to the closest Sunday, then the formula should give you
Sun Sept 10th, but it is giving me Sun Sept 03. The funny thing is that
works for some days, but for other do not work. Can you help me?

Fernando


"Tom Ogilvy" wrote:

something like:

=IF(WEEKDAY(TODAY()-B9,1) =
3,TODAY()-B9,TODAY()-B9-(WEEKDAY(TODAY()-B9))-(7-3))

B9 contains the number of days to subtract
Where 3 represents Tuesday. Change to suit.

--
Regards,
Tom Ogilvy


"Fernando" wrote:

Need to calculate dates by subtracting a certain number of days, but if it is
not a particular day of the week, it needs to go back to the previous week
and give me the date of that particular day of the week.

  #4   Report Post  
Posted to microsoft.public.excel.misc
daddylonglegs
 
Posts: n/a
Default Subtract # of days from date, but if not sat, goto previous sat?


Hi Fernando, try this formula, again B9 is the number of days to
subtract but the *2* represents Tuesday (0=sun through to 6 =sat)

=TODAY()-B9-WEEKDAY(TODAY()-B9-*2*)+1

so if you always want to find a Sunday it's just

=TODAY()-B9-WEEKDAY(TODAY()-B9)+1


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=537744

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
Conditional formatting based on a date + 30 days Laura4363 Excel Discussion (Misc queries) 5 January 13th 06 11:07 AM
set a date in columns 7 days apart Squirel Eater Excel Worksheet Functions 8 June 26th 05 02:00 AM
Subtract a group of cells from a total based on ending date Nicholas Scarpinato Excel Discussion (Misc queries) 0 May 17th 05 03:25 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Excel Worksheet Functions 2 February 10th 05 07:18 PM
Roll back to previous date Jay Excel Worksheet Functions 2 December 3rd 04 03:35 PM


All times are GMT +1. The time now is 06:07 AM.

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

About Us

"It's about Microsoft Excel"