Excel Tricks: Writing Your Own Function to Count Business Days

Excel Tricks: Writing Your Own Function to Count Business Days

David Lv13

Excel Tricks: Writing Your Own Function to Count Business Days

With Microsoft Excel’s

    `NETWORKDAYS`

function, you can count the number of workdays that fall between two specified dates. This function excludes Saturdays, Sundays, and optionally the specified holidays. We’ll show you how to use it.

This function can account for holidays in its calculation, but you must specify those holidays in a column, so be ready with a list of your holiday dates. Also, it’s important you keep in mind that this function counts both the starting date and the ending date in the calculation .

Related: Use Excel to Calculate How Many Days Until an Event

Find the Workdays Between Two Dates in Excel

To get the number of workdays that fall between two dates, first, open your spreadsheet with Microsoft Excel.

In your spreadsheet, click the cell where you want to display the resulting workday number.

Select a cell to display the NETWORKDAYS result.

In the selected cell, type the following function and press Enter. In the function, replace B2 with the cell that contains the starting date and C2 with the cell containing the ending date.

=NETWORKDAYS(B2,C2)

Type the NETWORKDAYS function.

Excel will calculate the number of workdays between your dates and display the result in the selected cell. Note that this number includes both the starting date and the ending date.

The result of the NETWORKDAYS function.

If you’d like to exclude any holidays from your calculation, then first, specify your holidays in a column. Like so:

Enter the holidays in a column.

Click the cell where you want to get the result, type the following function, and press Enter. In this function, replace B2 with the cell that contains the starting date, C2 with the cell that contains the ending date, and E2:E6 with the range where you’ve specified your holidays.

=NETWORKDAYS(B2,C2,E2:E6)

Use NETWORKDAYS with holidays.

Excel will display the result in your selected cell. Note that this count excludes your specified holidays but includes the starting and the ending date.

NETWORKDAYS' result with holidays.

And that’s how you can use an Excel function to quickly find the number of days someone has worked between any two dates. Very useful!


Do you want to find the number of full days between two dates in Excel ? If so, there’s a quick way to do that.

Related: How to Find the Number of Days Between Two Dates in Microsoft Excel

vMix 4K - Software based live production. vMix 4K includes everything in vMix HD plus 4K support, PTZ control, External/Fullscreen output, 4 Virtual Outputs, 1 Replay, 4 vMix Call, and 2 Recorders.
This bundle includes Studio 200 for vMix from Virtualsetworks, HTTP Matrix 1.0 automation scheduler, and 4 introductory training videos from the Udemy vMix Basic to Amazing course.

  • Title: Excel Tricks: Writing Your Own Function to Count Business Days
  • Author: David
  • Created at : 2024-08-28 00:49:17
  • Updated at : 2024-08-29 00:49:17
  • Link: https://win11.techidaily.com/excel-tricks-writing-your-own-function-to-count-business-days/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Excel Tricks: Writing Your Own Function to Count Business Days