Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rossta
 
Posts: n/a
Default Calculating first/last Monday, Tuesday, etc. in a given month in E

Thanks for the replies to my previous question. I would also like to use
Excel to identify the first and last Monday, Tuesday, etc. of a given month
by date. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default Calculating first/last Monday, Tuesday, etc. in a given month in E

Try something like this:

For
A1: (a date) eg 03/01/2006
A2: (a day to find) eg TUE

First occurrence of A2 in the month containing A1
C1:
=DATE(YEAR(A1),MONTH(A1),1+7)-WEEKDAY(DATE(YEAR(A1),MONTH(A1),8-MATCH(A2,{"SUN","MON","TUE","WED","THU","FRI","SAT "},0)))

Last occurrence of A2 in the month containing A1
C2:
=DATE(YEAR(A1),MONTH(A1)+1,1+7)-WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,8-MATCH(A2,{"SUN","MON","TUE","WED","THU","FRI","SAT "},0)))-7

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Rossta" wrote:

Thanks for the replies to my previous question. I would also like to use
Excel to identify the first and last Monday, Tuesday, etc. of a given month
by date. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Calculating first/last Monday, Tuesday, etc. in a given month in E

On Fri, 26 May 2006 11:49:03 -0700, Rossta
wrote:

Thanks for the replies to my previous question. I would also like to use
Excel to identify the first and last Monday, Tuesday, etc. of a given month
by date. Thanks.


With a date in some month in A1:

First Monday:

B1: =A1-DAY(A1)+8-WEEKDAY(A1-DAY(A1)+6)

Last Monday

C1: =B1+28-7*(MONTH(B1)<MONTH(B1+28))


--ron
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Calculating first/last Monday, Tuesday, etc. in a given month in E

On Fri, 26 May 2006 20:31:35 -0400, Ron Rosenfeld
wrote:

On Fri, 26 May 2006 11:49:03 -0700, Rossta
wrote:

Thanks for the replies to my previous question. I would also like to use
Excel to identify the first and last Monday, Tuesday, etc. of a given month
by date. Thanks.


With a date in some month in A1:

First Monday:

B1: =A1-DAY(A1)+8-WEEKDAY(A1-DAY(A1)+6)

Last Monday

C1: =B1+28-7*(MONTH(B1)<MONTH(B1+28))


--ron


To expand the above to cover any day of the week, change B1:

B1: =A1-DAY(A1)+8-WEEKDAY(A1-DAY(A1)+8-DOW)

where DOW = Day of Week (1=Sun; 2=Mon; etc.)

C1 stays the same.


--ron
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
calculating number of three month periods between two dates... neil Excel Discussion (Misc queries) 3 May 21st 06 01:52 PM
Function to write Weekday - Monday, Tuesday etc Shrikant Excel Discussion (Misc queries) 3 September 26th 05 11:32 AM
Calculating Month Average Exch Rate from Exchange Rates Calendar!!! StanUkr Excel Worksheet Functions 0 September 14th 05 11:12 AM
Calculating recurring date in following month, calculating # days in that period Walterius Excel Worksheet Functions 6 June 4th 05 11:21 PM
Date Calculations Bruce Excel Worksheet Functions 11 May 19th 05 01:09 AM


All times are GMT +1. The time now is 06:33 PM.

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"