+ Reply to Thread
Results 1 to 5 of 5

Function to count Number of weekday in a Month

  1. #1
    Registered User
    Join Date
    05-20-2005
    Posts
    9

    Function to count Number of weekday in a Month

    Hi
    I wonder if anybody knows if there is a function that shows number of weekday (from Mon to Fri) in a given month like in May 2005, there are 22 weekdays.
    Thank you

  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    I strung 5/1 thru 5/31 in cells a1:a31, and this does it for you

    =COUNT(IF(WEEKDAY(A1:A31,2)<6,A1:A31))

    not sure how to do it without the list of dates
    not a professional, just trying to assist.....

  3. #3
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Here's another way...

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(2005,5,1)&":"&DATE(2005,5,31))),2)<6))

    OR

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

    ...where A1 contains your start date, and B1 contains your end date.

    Hope this helps!

  4. #4
    Registered User
    Join Date
    05-20-2005
    Posts
    9
    Thank you for your help. I found out that with the use of formula to calculate first date and last date of the month, we can do this formula for the current month like this and it works great.
    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(YEAR(TODAY()),MONTH(TODAY()),1)&":"&(DATE(YEAR(TODAY()), MONTH(TODAY())+1,1)-1))),2)<6))

    This formula will give number of weekdays for Jan

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(YEAR(TODAY()),MONTH(1),1)&":"&(DATE(YEAR(TODAY()), MONTH(2)+1,1)-1))),2)<6))

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Quote Originally Posted by thuanpham
    This formula will give number of weekdays for Jan

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(YEAR(TODAY()),MONTH(1),1)&":"&(DATE(YEAR(TODAY()), MONTH(2)+1,1)-1))),2)<6))
    Actually, your formula should be...

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(YEAR(TODAY()),1,1)&":"&(DATE(YEAR(TODAY()),2,1)-1))),2)<6))

    Otherwise...

    =SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(DATE(YEAR(TODAY()),MONTH(1), 1)&":"&(DATE(YEAR(TODAY()),MONTH(12)+1,1)-1))),2)<6))

    ...will still give you 21.

    Hope this helps!

+ 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