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
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
"Mark Scholes" <[email protected]> wrote in message
news:[email protected]...
> 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
On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
<[email protected]> wrote:
>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
On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
<[email protected]> wrote:
>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
On Tue, 22 Feb 2005 16:36:43 -0800, "Mark Scholes"
<[email protected]> wrote:
>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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks