First Friday in a Month

  • Thread starter Thread starter Michael Siegel
  • Start date Start date
M

Michael Siegel

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
 
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

Try this in cell you want the Friday date:
=A1-WEEKDAY(A1)+6
 
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
 
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


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
 
Doh!!! September, too! Ugh!

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

Thanks Ron.

Jason
 
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
 
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top