+ Reply to Thread
Results 1 to 8 of 8

Get the amount of working days in a month using the computer date

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Perth
    MS-Off Ver
    Excel 2010
    Posts
    16

    Get the amount of working days in a month using the computer date

    Thanks to all who have posted, and really appreciate the explanations to the code

    Thanks all




    So i need the spread sheet to calculate how many working days of the month have been worked, but want the code to automatically pull the date from my computers date.

    Today is the 6th of November - and on a 5 day week basis we have only worked 3 of the 6 days (because 2 were a weekend and the 6th is not yet finished)

    The help in these forums has been spot on and every time and i am very grateful for everyone's help

    Thanks in advance!

    Excel help 3.xlsx
    Last edited by Drunknmonkie; 11-06-2013 at 07:55 PM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Get the amount of working days in a month using the computer date

    hi there. is the file relevant to what you need? seems like you can use:
    =NETWORKDAYS(DATE(YEAR(TODAY()),MONTH(TODAY()),1),TODAY())-1

    DATE(YEAR(TODAY()),MONTH(TODAY()),1) gives you the year & month of today's date but on the 1st of the month. TODAY() gives you today's date of course. i then minus 1 because you don't want to count today. you could even have a list of holidays say in U1:U3, and then:=NETWORKDAYS(DATE(YEAR(TODAY()),MONTH(TODAY()),1),TODAY(),U1:U3)-1

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Get the amount of working days in a month using the computer date

    The function that delivers what you want is:

    =NETWORKDAYS( TODAY() - DAY(TODAY()) +1, TODAY() -1)

    This will count the total workdays (excluding Saturday and Sunday) from the first day of the current month through yesterday.

    If there are holidays you also want excluded they are optional terms that can be added to the inputs as optional terms.

    If you want to change what the "Weekends" are (Fri + Sat or Thu + Fri or others) that can be accomplished with the NETWORKDAYS.INTL() function.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Get the amount of working days in a month using the computer date

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Start date: first day of the month
    End Date: yesterday ... TODAY()-1
    HolidayList: is a Named Range with the holiday dates.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    07-09-2012
    Location
    India
    MS-Off Ver
    Excel 97/2003/2007/2010
    Posts
    67

    Re: Get the amount of working days in a month using the computer date

    hi Drunknmonkie,

    please paste it
    =NETWORKDAYS(DATE(2013,11,1),TODAY())

    will return the value in days..
    if you want it in hours ( if a day has 8 hours working)

    =NETWORKDAYS(DATE(2013,11,1),TODAY())*8


    thanks,

    sathya

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Get the amount of working days in a month using the computer date

    It has been pointed out to me that there are dates when my formula will return a negative value. Thanks for being so discreet benishiryo.

    It has to be said that all the formulae can do that given the right choice of date

    If you put today's date, =TODAY(), into a cell rather than using it directly, it will a) avoid having to calculate the value several times and b) give you the opportunity to test the effect of different dates. Simply type a date into the cell (overwriting =TODAY()) to see what value it will return.

    benishiryo:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    01/09/2013: -1 01/11/2013: 0


    ben_hensel:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    01/09/2013: 0 01/11/2013: -2


    tmshucks:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    01/09/2013: 0 01/11/2013: -2




    So, you might want to test for that condition ... not sure what you want the answer to be. Guess it would be zero (0)?


    Regards, TMS

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Get the amount of working days in a month using the computer date

    Thanks for the rep

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Get the amount of working days in a month using the computer date

    If a holiday range isn't required then you can put the current date as the holiday range to prevent any negative values, e.g. with today's date in A1 use

    =NETWORKDAYS(EOMONTH(A1,-1)+1,A1,A1)
    Audere est facere

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sumproduct for month to date (ONLY WORKING DAYS)!
    By jw01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2013, 09:57 AM
  2. Show days in a month dynamically + working days
    By vemix in forum Excel General
    Replies: 5
    Last Post: 12-28-2012, 07:54 AM
  3. [SOLVED] Macros for: If Today's Date minus other date is greater than certain amount of days Then
    By lottidotti in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-24-2012, 04:46 PM
  4. hide cells depend by amount days in month
    By eugz in forum Excel General
    Replies: 2
    Last Post: 12-18-2009, 03:54 PM
  5. [SOLVED] amount of working days per month
    By Nigel in forum Excel General
    Replies: 2
    Last Post: 11-29-2005, 06:45 AM

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