+ Reply to Thread
Results 1 to 18 of 18

Count no of work Days in a month

  1. #1
    Registered User
    Join Date
    05-11-2007
    Location
    Bangalore, India
    MS-Off Ver
    MS Office 2013
    Posts
    58

    Count no of work Days in a month

    Hi All,

    How do i count no of days in a month; excluding saturday & sunday.

    regards,
    Harish S

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Good morning Harish S,

    Take a look at this link on NETWORKDAYS, you will need to add-in the Analysis Tool Pak

    http://www.exceltip.com/st/Calculati..._days/844.html

    http://office.microsoft.com/en-gb/ex...277241033.aspx
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning harishs

    Alternately, use this formula to return the number of days in the current month without the Analysis ToolPak add-in :
    =DAY(DATE(YEAR(NOW()),MONTH(NOW())+1,0))

    To return the number of days in a given month, replace the two "Now()" functions with a cell containing a valid date.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi dominicb,

    His question was how many weekdays - excluding weekends

    How about

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe a function

    Please Login or Register  to view this content.

    Put your holidays within the Array( ) statement. You'll need to
    load the Analysis Tool Pack VBA add-in, and then in VBA go to the
    Tools menu, choose References, and choose atvbaen.xls.


    More information about working with holidays can be found at
    www.cpearson.com/excel/holidays.htm

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    If you're going to use ATP functions then you might as well use EOMONTH as well as NETWORKDAYS so for the number of workdays in the current month

    =NETWORKDAYS(EOMONTH(TODAY(),-1)+1,EOMONTH(TODAY(),0))

    or for any month if you have the first day of the month in A1

    =NETWORKDAYS(A1,EOMONTH(A1,0))

    ...or without using Analysis ToolPak functions....

    =SUM(INT((WEEKDAY(A1-{2,3,4,5,6})+DAY(A1+30-DAY(A1+31)))/7))

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by dominicb
    Alternately, use this formula to return the number of days in the current month without the Analysis ToolPak add-in :
    =DAY(DATE(YEAR(NOW()),MONTH(NOW())+1,0))
    As oldchippy says, possibly not what the OP wants, but here's a way to get total days in the current month

    =42-DAY(NOW()-DAY(NOW())+42)

  8. #8
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning daddylonglegs

    Just knew you'd jump into this thread somewhere

    Quote Originally Posted by daddylonglegs
    =42-DAY(NOW()-DAY(NOW())+42)
    How the hell does that work!?!?!?!

    DominicB

  9. #9
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Please Login or Register  to view this content.
    It is a good one this, it seems like any number between 32 and 59 calculates correctly - or am I wrong?

  10. #10
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Quote Originally Posted by oldchippy
    seems like any number between 32 and 59 calculates correctly - or am I wrong?
    I get it working from 32 to 61.
    But that doesn't help me figure out how it works...

    DominicB

  11. #11
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    I still don't know how it works, but if you change the NOW() to 01/02/2007, your numbers throw up an incorrect answer - some months work below 32 or above 59, but all dates seem to work between 32 and 59.

    We're waiting DADDY!

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Yes, any number from 32 to 59 guarantees that it works.

    =NOW()-DAY(NOW()) gives you some time on the last day of last month, If you then add any number between 32 and 59 you're guaranteed to be somewhere in next month.

    Take 32 for instance, the formula

    =DAY(NOW()-DAY(NOW())+32)

    Will return 1 if current month has 31 days, 2 if current month has 30 days, 3 if current month has 29 days or 4 if current month has 28 days.

    So deduct that number from 32 and you have the number of days in the current month

    =32-DAY(NOW()-DAY(NOW())+32)

    I like to suggest 42 because that number, of course, is the Answer to life, the universe and everything

  13. #13
    Registered User
    Join Date
    08-24-2007
    Posts
    35
    Hitchhikers guide to the galaxy, quality DLL

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by dominicb
    Just knew you'd jump into this thread somewhere
    I can never resist the lure of a juicy date [question]

    Further to the above. Using similar logic, if you have the 1st of a month in A1 this formula gives the number of days in the month

    =50-DAY(A1+49)

  15. #15
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi daddylonglegs

    Quote Originally Posted by daddylonglegs
    So deduct that number from 32 and you have the number of days in the current month
    Aaaaaaahhhhhh! Clever.

    Quote Originally Posted by daddylonglegs
    I like to suggest 42 because that number, of course, is the Answer to life, the universe and everything
    ...but now you've just gone down in my estimation. Must try harder...

    Quote Originally Posted by daddylonglegs
    I can never resist the lure of a juicy date
    And why would you. Knew it was right up your street. Just thought I'd answer it wrong for a laugh

    DominicB

  16. #16
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Please Login or Register  to view this content.
    That's another good one too for the file - thanks daddylonglegs

  17. #17
    Registered User
    Join Date
    09-06-2010
    Location
    Seattle, wa
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Count no of work Days in a month

    I am attempting to count the Days in a month excluding holidays and weekends.
    This formula "=NETWORKDAYS(EOMONTH(TODAY(),-1)+1,EOMONTH(TODAY(),0))" counts holidays as regular non week end days

  18. #18
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Count no of work Days in a month

    Good evening cjtwhidbey

    ...and welcome to the forum!!
    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    DominicB

+ 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