Number of sundays

  • Thread starter Thread starter Mark Scholes
  • Start date Start date
M

Mark Scholes

Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS
 
Mark,

Try this.

Function SundaysFromStartOfYear(dtInput As Date)
'assumes dtinput is a sunday
SundaysFromStartOfYear = Int((dtInput - DateSerial(Year(dtInput), 1, 1)) /
7) + 1
End Function

Robin Hammond
www.enhanceddatasystems.com
 
Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS

With your Sunday date in A1:

=(A1-DATE(YEAR(A1),1,7)+WEEKDAY(DATE(YEAR(A1),1,6)))/7+1

gives the Sunday number; counting the first Sunday in the year as number 1.

If you don't want to count the first Sunday, then omit the +1 at the end of the
formula.


--ron
 
Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS

OOPS.

My formula should be:

=DATE(YEAR(A1),1,8)-WEEKDAY(DATE(YEAR(A1),1,7))


--ron
 
Hi,
I have a date which is a sunday and I need to find how
many sundays it is from the begining of the year.

Thanks MarkS

Maybe now that I am awake I can get it correct:

=(A1-DATE(YEAR(A1),1,8)+WEEKDAY(DATE(YEAR(A1),1,7)))/7+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