+ Reply to Thread
Results 1 to 5 of 5

Function that returns the number of a given day of the week in a given month

  1. #1
    Registered User
    Join Date
    12-01-2007
    Posts
    42

    Function that returns the number of a given day of the week in a given month

    Hello,

    I am looking for a function that would allow me to know the number of a given day of the week in a month.
    Assuming that this function is: NbJSMois
    and that we had the days of the week as follows:
    Monday = 1, Tuesday = 2, ..., Sunday = 7

    Eg. NBJSMois (4, 1, 2009) = 5

    There are 5 Thursdays in effect in January 2009.

    Thank you for any response.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Function that returns the number of a given day of the week in a given month

    hae you tried the weekday() function? oops misread post
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695

    Re: Function that returns the number of a given day of the week in a given month

    If you have the day of week in A1, month in B1 and year in C1 then this formula will give the number of days

    =4+(DAY(DATE(C1,B1,35))<WEEKDAY(DATE(C1,B1,0)-A1))

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Function that returns the number of a given day of the week in a given month

    there is also this udf from ozgrid

    http://www.ozgrid.com/VBA/excel-days-month-amount.htm
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-01-2007
    Posts
    42

    Re: Function that returns the number of a given day of the week in a given month

    At last I get it!

    Short & nice!
    Attached Files Attached Files

+ 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