简体   繁体   中英

Excel Formula: Get Year to Date Workday Count in Current Month

I need a formula that gives me the YTD workday count for each month.

For example:

If today is 8/6/2015 - the workday count should be 17 (excluding weekends) If today is 9/3/2015- the workday count should be 18 (excluding weekend and 1 holiday)

Thanks,

This is just the native Excel function:

=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31))

Note that you will need to choose a set of holidays to exclude from the working days function, and define that as a Name in the Formula Ribbon -> Name Manager. ie:

=NETWORKDAYS(TODAY(),DATE(YEAR(TODAY()),MONTH(TODAY()),31),CustomHolidays)

Where CustomHolidays has been defined as a name which means:

={02/14/2015;03/15/2015;...}

You need NETWORKDAYS between the first of the month, and the last of the month.

Assuming your date is in A2, first of the month is simple, A2-DAY(A2)+1. Last of the month is harder as it could be 28, 29, 30 or 31. Youy can use EOMONTH to get this though, EOMONTH(A2,0)

Put it all together

=NETWORKDAYS(A2-DAY(A2)+1,EOMONTH(A2,0))

As has been commented, you can also include holidays if you wish to exclude these.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM