Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default First Friday in a Month

Hello.

How can I code a cell to return the "First Friday in a given month"?
Please assume that cell A1 contains a date which represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default First Friday in a Month

=A1+6-WEEKDAY(A1)

HTH
Jason
Atlanta, GA

-----Original Message-----
Hello.

How can I code a cell to return the "First Friday in a

given month"?
Please assume that cell A1 contains a date which

represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default First Friday in a Month

Michael Siegel wrote

Hello.

How can I code a cell to return the "First Friday in a given month"?
Please assume that cell A1 contains a date which represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Try this in cell you want the Friday date:
=A1-WEEKDAY(A1)+6

--
David
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default First Friday in a Month

This example assumes that Range("B1") is formatted for dates if not it might
return a serial number.


sub findfriday ()
y = Range("a1").Value
goagain:
dayd = Format(y, "dddd")
If dayd = "Friday" Then Range("b1").Value = y: Exit Sub
y = y + 1
GoTo goagain
End Sub
end sub



"Michael Siegel" wrote:

Hello.

How can I code a cell to return the "First Friday in a given month"?
Please assume that cell A1 contains a date which represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default First Friday in a Month

On Mon, 14 Feb 2005 13:25:45 -0800, "Jason Morin"
wrote:

=A1+6-WEEKDAY(A1)



Hmmm. Did you try 1/1/2005?


--ron


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default First Friday in a Month

On Mon, 14 Feb 2005 12:49:26 -0800, Michael Siegel
wrote:

Hello.

How can I code a cell to return the "First Friday in a given month"?
Please assume that cell A1 contains a date which represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



If the date is always the first of the month, then:

=A1+7-WEEKDAY(A1-DAY(A1)+2)

For ANY date in a month in A1, then:

=A1-DAY(A1)+8-WEEKDAY(A1-DAY(A1)+2)


--ron
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default First Friday in a Month

Doh!!! September, too! Ugh!

=A1+IF(MONTH(A1+6-WEEKDAY(A1))=MONTH(A1),6-WEEKDAY(A1))

Thanks Ron.

Jason


-----Original Message-----
On Mon, 14 Feb 2005 13:25:45 -0800, "Jason Morin"
wrote:

=A1+6-WEEKDAY(A1)



Hmmm. Did you try 1/1/2005?


--ron
.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default First Friday in a Month


The following picks up the first Friday, no matter what date is in B1
=DATE(YEAR(B1),MONTH(B1),CHOOSE(WEEKDAY(DATE(YEAR( B1),MONTH(B1),4)),2,1,7,6,5,4,3))


Modified from Dave McRitchie's site:
http://www.mvps.org/dmcritchie/excel/datetime.htm

Steve

"ben" wrote in message
...
This example assumes that Range("B1") is formatted for dates if not it
might
return a serial number.


sub findfriday ()
y = Range("a1").Value
goagain:
dayd = Format(y, "dddd")
If dayd = "Friday" Then Range("b1").Value = y: Exit Sub
y = y + 1
GoTo goagain
End Sub
end sub



"Michael Siegel" wrote:

Hello.

How can I code a cell to return the "First Friday in a given month"?
Please assume that cell A1 contains a date which represents the first
day in the month (i.e. 1/1/05 or 5/1/13).

Thanks.
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default First Friday in a Month

Ron,

Thanks! I used the first formula, since the referenced date is always
the first day in the month. It worked. Now I just have to analyze the
formula to figure out WHY.

-Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default First Friday in a Month

On Tue, 15 Feb 2005 05:02:02 -0800, Michael Siegel
wrote:

Ron,

Thanks! I used the first formula, since the referenced date is always
the first day in the month. It worked. Now I just have to analyze the
formula to figure out WHY.

-Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Michael,

It was late when I wrote that, but if the day is always the first, then formula
simplifies even further:

=A1+7-WEEKDAY(A1+1)


--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
Last Friday of the month Alfredo_CPA Excel Worksheet Functions 9 September 17th 08 10:16 PM
3rd Friday every month Zsolt Szabó Excel Discussion (Misc queries) 18 January 15th 07 04:07 AM
Friday In Month Winston New Users to Excel 4 October 27th 05 10:00 PM
Find out first Friday every month Ragdyer Excel Discussion (Misc queries) 7 September 2nd 05 12:59 AM
3rd friday in month [email protected] Excel Worksheet Functions 17 June 11th 05 08:47 PM


All times are GMT +1. The time now is 10:51 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"