+ Reply to Thread
Results 1 to 5 of 5

Number of sundays

  1. #1
    Mark Scholes
    Guest

    Number of sundays

    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

  2. #2
    Robin Hammond
    Guest

    Re: Number of sundays

    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




  3. #3
    Ron Rosenfeld
    Guest

    Re: Number of sundays

    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

  4. #4
    Ron Rosenfeld
    Guest

    Re: Number of sundays

    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

  5. #5
    Ron Rosenfeld
    Guest

    Re: Number of sundays

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1