+ Reply to Thread
Results 1 to 18 of 18

Count no of work Days in a month

Hybrid View

  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

    =NETWORKDAYS(DATE(YEAR(TODAY(),MONTH(TODAY(),1),DATE(YEAR(TODAY(),MONTH(TODAY()+1,0))

  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

    Function WorkDaysInMonth(Month As Integer, Yr As Integer) 
        Dim Holidays As Variant 
        Holidays = Array("1/1/" & Yr, "25/12/" & Yr, "26/12/" & Yr) 
    
    
        WorkDaysInMonth = networkdays( _ 
            DateSerial(Year(Now), Month, 0), _ 
            DateSerial(Year(Now), Month + 1, 0), Holidays) 
    End Function

    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
    =42-DAY(NOW()-DAY(NOW())+42)
    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 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)

+ 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