Work days between dates excel

Explanation 

The Excel NETWORKDAYS function calculates the number of working days between two dates. NETWORKDAYS automatically excludes weekends (Saturday and Sunday) and can optionally exclude a list of holidays supplied as dates. 

For example, in the screenshot shown, the formula in D6 is:

=NETWORKDAYS(B6,C6) // returns 5

This formula returns 5 since there are 5 working days between December 23 and December 27, and no holidays have been provided. Note that NETWORKDAYS includes both the start and end dates in the calculation if they are workdays.

NETWORKDAYS can also exclude a custom list of holidays. In the next cell down, we use the same formula with the same dates, plus a list of holidays in B10:B11.

=NETWORKDAYS(B7,C7,B10:B11) // returns 3

This formula returns 3, since two of the 5 days are holidays.

Workdays remaining from today

To calculate the number of workdays remaining from today, you can use WORKDAY with the TODAY function like this:

=NETWORKDAYS(TODAY(),A1)

where cell A1 contains an end date in the future.

Custom weekends

If you need take into account custom weekends (i.e. weekends are Saturday only, Sunday and Monday, etc.) you’ll need to switch to the more robust NETWORKDAYS.INTL function, which allows you to set what days of the week are considered are considered weekends, by supplying a weekend argument in the form of a numeric code. 

Need a date?

If you need a date n workdays in the past or future, see the WORKDAY function.

Use the DATEDIF function when you want to calculate the difference between two dates. First put a start date in a cell, and an end date in another. Then type a formula like one of the following.

Warning: If the Start_date is greater than the End_date, the result will be #NUM!.

Difference in days

=DATEDIF(D9,E9,"d") with result of 856

In this example, the start date is in cell D9, and the end date is in E9. The formula is in F9. The “d” returns the number of full days between the two dates.

Difference in weeks

=(DATEDIF(D13,E13,"d")/7) and result: 122.29

In this example, the start date is in cell D13, and the end date is in E13. The “d” returns the number of days. But notice the /7 at the end. That divides the number of days by 7, since there are 7 days in a week. Note that this result also needs to be formatted as a number. Press CTRL + 1. Then click Number > Decimal places: 2.

Difference in months

=DATEDIF(D5,E5,"m") and result: 28

In this example, the start date is in cell D5, and the end date is in E5. In the formula, the “m” returns the number of full months between the two days.

Difference in years

=DATEDIF(D2,E2,"y") and result: 2

In this example, the start date is in cell D2, and the end date is in E2. The “y” returns the number of full years between the two days.

Calculate age in accumulated years, months, and days

You can also calculate age or someone’s time of service. The result can be something like “2 years, 4 months, 5 days.”

1. Use DATEDIF to find the total years.

=DATEDIF(D17,E17,"y") and result: 2

In this example, the start date is in cell D17, and the end date is in E17. In the formula, the “y” returns the number of full years between the two days.

2. Use DATEDIF again with “ym” to find months.

=DATEDIF(D17,E17,"ym") and result: 4

In another cell, use the DATEDIF formula with the “ym” parameter. The “ym” returns the number of remaining months past the last full year.

3. Use a different formula to find days.

=DATEDIF(D17,E17,"md") and result: 5

Now we need to find the number of remaining days. We’ll do this by writing a different kind of formula, shown above. This formula subtracts the first day of the ending month (5/1/2016) from the original end date in cell E17 (5/6/2016). Here’s how it does this: First the DATE function creates the date, 5/1/2016. It creates it using the year in cell E17, and the month in cell E17. Then the 1 represents the first day of that month. The result for the DATE function is 5/1/2016. Then, we subtract that from the original end date in cell E17, which is 5/6/2016. 5/6/2016 minus 5/1/2016 is 5 days.

Warning: We don’t recommend using the DATEDIF «md» argument because it may calculate inaccurate results.

4. Optional: Combine three formulas in one.

=DATEDIF(D17,E17,"y")&" years, "&DATEDIF(D17,E17,"ym")&" months, "&DATEDIF(D17,E17,"md")&" days" and result: 2 years, 4 months, 5 days

You can put all three calculations in one cell like this example. Use ampersands, quotes, and text. It’s a longer formula to type, but at least it’s all in one. Tip: Press ALT+ENTER to put line breaks in your formula. This makes it easier to read. Also, press CTRL+SHIFT+U if you can’t see the whole formula.

Download our examples

Other date and time calculations

As you saw above, the DATEDIF function calculates the difference between a start date and an end date. However, instead of typing specific dates, you can also use the TODAY() function inside the formula. When you use the TODAY() function, Excel uses your computer’s current date for the date. Keep in mind this will change when the file is opened again on a future day.

=DATEDIF(TODAY(),D28,"y") and result: 984

Please note that at the time of this writing, the day was October 6, 2016.

Use the NETWORKDAYS.INTL function when you want to calculate the number of workdays between two dates. You can also have it exclude weekends and holidays too.

Before you begin: Decide if you want to exclude holiday dates. If you do, type a list of holiday dates in a separate area or sheet. Put each holiday date in its own cell. Then select those cells, select Formulas > Define Name. Name the range MyHolidays, and click OK. Then create the formula using the steps below.

1. Type a start date and an end date.

Start date in cell D53 is 1/1/2016, end date is in cell E53 is 12/31/2016

In this example, the start date is in cell D53 and the end date is in cell E53.

2. In another cell, type a formula like this:

=NETWORKDAYS.INTL(D53,E53,1) and result: 261

Type a formula like the above example. The 1 in the formula establishes Saturdays and Sundays as weekend days, and excludes them from the total.

Note: Excel 2007 doesn’t have the NETWORKDAYS.INTL function. However, it does have NETWORKDAYS. The above example would be like this in Excel 2007: =NETWORKDAYS(D53,E53). You don’t specify the 1 because NETWORKDAYS assumes the weekend is on Saturday and Sunday.

3. If necessary, change the 1.

Intellisense list showing 2 - Sunday, Monday; 3 - Monday, Tuesday, and so on

If Saturday and Sunday are not your weekend days, then change the 1 to another number from the IntelliSense list. For example, 2 establishes Sundays and Mondays as weekend days.

If you are using Excel 2007, skip this step. Excel 2007’s NETWORKDAYS function always assumes the weekend is on Saturday and Sunday.

4. Type the holiday range name.

=NETWORKDAYS.INTL(D53,E53,1,MyHolidays) and result: 252

If you created a holiday range name in the “Before you begin” section above, then type it at the end like this. If you don’t have holidays, you can leave the comma and MyHolidays out. If you are using Excel 2007, the above example would be this instead: =NETWORKDAYS(D53,E53,MyHolidays).

Tip: If you don’t want to reference a holiday range name, you can also type a range instead, like D35:E:39. Or, you could type each holiday inside the formula. For example if your holidays were on January 1 and 2 of 2016, you’d type them like this: =NETWORKDAYS.INTL(D53,E53,1,{«1/1/2016″,»1/2/2016»}). In Excel 2007, it would look like this: =NETWORKDAYS(D53,E53,{«1/1/2016″,»1/2/2016»})

You can calculate elapsed time by subtracting one time from another. First put a start time in a cell, and an end time in another. Make sure to type a full time, including the hour, minutes, and a space before the AM or PM. Here’s how:

1. Type a start time and end time.

Start date/time of 7:15 AM, End date/time of 4:30 PM

In this example, the start time is in cell D80 and the end time is in E80. Make sure to type the hour, minute, and a space before the AM or PM.

2. Set the h:mm AM/PM format.

Format cells dialog box, Custom command, h:mm AM/PM type

Select both dates and press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Make sure to select Custom > h:mm AM/PM, if it isn’t already set.

3. Subtract the two times.

=E80-D80 and result: 9:15 AM

In another cell, subtract the start time cell from the end time cell.

4. Set the h:mm format.

Format Cells dialog, Custom command, h:mm type

Press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Choose Custom > h:mm so that the result excludes AM and PM.

To calculate the time between two dates and times, you can simply subtract one from the other. However, you must apply formatting to each cell to ensure that Excel returns the result you want.

1. Type two full dates and times.

Start date of 1/1/16 1:00 PM; End date of 1/2/16 2:00 PM

In one cell, type a full start date/time. And in another cell, type a full end date/time. Each cell should have a month, day, year, hour, minute, and a space before the AM or PM.

2. Set the 3/14/12 1:30 PM format.

Format Cells dialog, Date command, 3/14/12 1:30 PM type

Select both cells, and then press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Then select Date > 3/14/12 1:30 PM. This isn’t the date you’ll set, it’s just a sample of how the format will look. Note that in versions prior to Excel 2016, this format might have a different sample date like 3/14/01 1:30 PM.

3. Subtract the two.

=E84-D84 and result of 1.041666667

In another cell, subtract the start date/time from the end date/time. The result will probably look like a number and decimal. You’ll fix that in the next step.

4. Set the [h]:mm format.

Format Cells dialog, Custom command, [h]:mm type

Press CTRL + 1 (or Image of the MAC Command button icon + 1 on the Mac). Select Custom. In the Type box, type [h]:mm.

Related Topics

DATEDIF function

NETWORKDAYS.INTL function

NETWORKDAYS

More date and time functions

Calculate the difference between two times

Watch Video – Calculate the Number of Workdays Between Two Dates

Excel has some powerful functions to calculate the number of days between two dates in Excel. These are especially useful when you’re creating Gantt charts or timelines for a proposal/project.

In this tutorial, you’ll learn how to calculate the number of days between two dates (in various scenarios):

Calculating the Total Number of Days Between Two Dates in Excel

Excel has multiple ways to calculate the days between two dates.

Using the DAYS Function

Excel DAYS function can be used to calculate the total number of days when you have the start and the end date.

You need to specify the ‘Start Date’ and the ‘End Date’ in the Days function, and it will give you the total number of days between the two specified dates.

For example, suppose you have the start date is in cell B1 and End Date is in cell B2 (as shown below):

Start date and end date in Excel

The following formula will give you the total number of days between the two dates:

=DAYS(B2,B1)

DAYS Formula to get the Number of Days

Note that you can also manually specify the dates in the Days function by putting it in double-quotes. Just make sure these dates in double-quotes is in an accepted date format in Excel.

Days function gives you the number of days between two dates. This means that if the dates are 1 Dec 2017 and 2 Dec 2017, it will return 1. If you want both the days to be counted, you need to add 1 to the result of Days function. You can read more about the Days function here.

Using the DATEDIF Function

DATEDIF function (derived from Date Difference) also allows you to quickly get the number of days between two dates. But unlike the DAYS function, it can do more than that.

You can also use the DATEDIF function to calculate the number of months or years that have elapsed in the two given dates.

Suppose you have the below dataset and you want to get the number of days between these two dates:

Start date and end date in Excel

You can use the below DATEDIF formula to do this:

=DATEDIF(B1,B2,"D")

The above DATEDIF formula takes three arguments:

  • The start date – B1 in this example
  • The end date – B2 in this example
  • “D” – the text string that tells the DATEDIF function what needs to be calculated.

Also note that unline the other Excel functions, when you type the DATEDIF function in Excel, it will not show the IntelliSense (the autocomplete option that helps you with the formula arguments).

If you only want to calculate the number of days between two given dates, then it’s better to use the DAYS function. DATEDIF is more suited when you want to calculate the total number of years or months that have passed in between two dates.

For example, the below formula would give you the total number of months between the two dates (in B1 and B2)

=DATEDIF(B1,B2,"M")

Similarly, the below formula will give you the total number of years between the two dates:

=DATEDIF(B1,B2,"Y")

You can read more about the DATEDIF function here. One of the common uses of this function is when you need to calculate age in Excel.

Number of Working Days Between Two Dates in Excel

Excel has two functions that will give you the total number of working days between two dates and will automatically account for weekends and specified holidays.

  • Excel NETWORKDAYS function – you should use this when the weekend days are Saturday and Sunday.
  • Excel NETWORKDAYS INTERNATIONAL function – use this when the weekend days are not Saturday and Sunday.

Let’s first quickly have a look at NETWORKDAYS Function syntax and arguments.

Excel NETWORKDAYS Function – Syntax & Arguments

=NETWORKDAYS(start_date, end_date, [holidays])

  • start_date – a date value that represents the start date.
  • end_date – a date value that represents the end date.
  • [holidays] – (Optional) It is a range of dates that are excluded from the calculation. For example, these could be national/public holidays. This could be entered as a reference to a range of cells that contains the dates, an array of serial numbers that represent the dates, or a named range.

Let’s first look at an example where you want to calculate the number of working days (business days) between two dates with Saturday and Sunday as weekends.

Dates data set where days needs to be calculated between two dates

To calculate the number of working days (Column D) – when the start date, end date, and holidays are specified – use the below formula in D3 and copy for all cells:

=NETWORKDAYS(B2,C2,$F$2:$F$6)

networkdays formula result

This function works great in most cases, except the ones where the weekends are days other than Saturday and Sunday.

For example, in middle-eastern countries, the weekend is Friday and Saturday, or in some jobs, people may have a six-day workweek.

To tackle such cases, Excel has another function – NETWORKDAYS.INTL (introduced in Excel 2010).

Before I take you through the example, let’s quickly learn about the syntax and arguments of Excel NETWORKDAY INTERNATIONAL function

Excel NETWORKDAYS INTERNATIONAL Function – Syntax & Arguments

=NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays])

  • start_date – a date value that represents the start date.
  • end_date – a date value that represents the end date.
  • [weekend] – (Optional) Here, you can specify the weekend, which could be any two days or any single day. If this is omitted, Saturday and Sunday are taken as the weekend.Networkdays International formula syntax and weekend options
  • [holidays] – (Optional) It is a range of dates that are excluded from the calculations. For example, these could be national/public holidays. This could be entered as a reference to a range of cells that contains the dates or could be an array of serial numbers that represent the dates.

Now let’s see an example of calculating the number of working days between two dates where the weekend days are Friday and Saturday.

Suppose you have a dataset as shown below:

networkdays function

To calculate the number of working days (Column D) with the weekend as Friday and Saturday, use the following formula:

=NETWORKDAYS.INTL(B2,C2,7,$F$2:$F$6)

The third argument in this formula (the number 7) tells the formula to consider Friday and Saturday as the weekend.

networkdays intl formula result

Number of Weekends Between Two Dates in Excel

We can use the NETWORKDAYS function to calculate the number of weekends between two dates.

While the Networkdays function calculates the number of working days, we can also use to get the number of weekend days between two dates.

Suppose we have a dataset as shown below:

Dataset to calculate the number of weekend days in Excel

Here is the formula that will give you the total number of weekends days between the two dates:

=DAYS(C2,B2)+1-NETWORKDAYS(B2,C2)

weekend formula - to give the number of weekend days between two dates

Number of Work Days in a Part-time Job

You can use Excel NETWORKDAYS.INTL function to calculate the number of workdays in a part-time job as well.

Let’s take an example where you are involved in a project where you have to work part-time (Tuesday and Thursday only).

Calculate part time working days in Excel - Dataset

Here is the formula that will get this done:

=NETWORKDAYS.INTL($B$3,$C$3,"1010111",$E$3:$E$7)

NETWORKDAYS International formula to get the part time working days

Note that instead of choosing the weekend from the drop-down that’s inbuilt in the function, we have used “1010111” (in double quotes).

  • 0 indicates a working day
  • 1 indicates a non-working day

The first number of this series represents Monday and the last number represents Sunday.

So “0000011 would mean that Monday to Friday are working days and Saturday and Sunday are non-working (weekend).

With the same logic, “1010111” indicates that only Tuesday and Thursday are working, and rest 5 days are non-working.

In case you have holidays (which you don’t want to get counted in the result), you can specify these holidays as the fourth argument.

Number of Mondays Between Two Dates

To find the number of Mondays between two dates (or any other day), we can use the same logic as used above in calculating part-time jobs.

Suppose you have a dataset as shown below:

Start date and end date to get the number of Mondays

Here is the formula that will give you the number of Mondays between the two dates:

=NETWORKDAYS.INTL(B2,C2,"0111111")

Using Networkdays INTL function to get the number of Mondays

In this formula, ‘0’ means a working day and ‘1’ means a non-working day.

This formula gives us the total number of working days considering that Monday is the only working day of the week.

Similarly, you can also calculate the number of any day between two given dates.

You May Also Like the Following Tutorials:

  • Excel Timesheet Calculator Template.
  • Convert Date to Text in Excel.
  • How to Group Dates in Pivot Tables in Excel.
  • How to Automatically Insert Date and Time Stamp in Excel.
  • Convert Time to Decimal Number in Excel (Hours, Minutes, Seconds)
  • How to SUM values between two dates in Excel
  • Get Day Name from Date in Excel
  • Check IF a Date is Between Two Given Dates in Excel
  • How to Add Week to Date in Excel?

WORKDAY function is designed to determine the start or end date of an event relative to a given starting or ending date based on the number of weekends and holidays, and returns the corresponding value in the form of Date data.

Function WORKDAY.INTL is designed to determine the date equal to the sum of the current date and the duration of the event, and returns the corresponding numeric value in the Excel time code.



Examples of using the functions WORKDAY and WORKDAY.INTL in Excel

Example 1. According to calculations, an employee of a company would need 236 hours of continuous work to complete the project. The project start is 08/18/2018. Determine the date of completion of the project. In the next 30 days there are no holidays, weekends — Saturday and Sunday.

View source data table:

Example 1.

To solve use the formula:

WORKDAY.

Argument Description:

  • B5 — the date the event began (work on the project);
  • B6 / B8 — the number of working days required for the project, provided that the working day lasts 8 hours

Result of calculations:

using the functions.

Automatically determined the number for delivery of the implemented project on the key.



How to calculate the number of working days between dates

To calculate the number of working days or holidays between two dates in Excel, you should use the NETWORKDAYS.INTL function:

.

As you can see, the total number of working days per year and 103 days off (262 + 103 = 365) is only in a non-pending 2019.

Example 2. The course of the subject in the school is designed for 46 classes, which are held on Monday, Wednesday and Friday. The beginning of the study of the subject — 03.09.2018 Upcoming holidays: 09/17/2018, 09/28/2018, 7/10/2018. Determine the date of the last class.

View source data table:

number of working days or holidays.

The formula for calculating:

Example 2.

The result of the calculations:

result.

The last lesson will be December 24, 2018.

Formula for the optimal calculation of number of working days between dates

Example 3. To perform work on time, two options were proposed: to increase the hours in working days to 10 hours per day or enter a six-day working week. The estimated duration of the work is 127 hours. Choose the best option if the project start is 08/20/2018.

View of data table:

Example 3.

To solve, use the following formula:

IF function checks the values returned by the functions WORKDAY.INTL and returns the corresponding result. The longer the date, the longer it will take to complete the project.

The result of the calculations:

WORKDAY.INTL.

That is, in order to complete work faster, it is better to increase the duration of the working day to 10 hours.

Features of using the functions WORKDAY and WORKDAY.INTL in Excel

WORKDAY function has the following syntax:

=WORKDAY(Start_date,Days,[Holidays])

Argument Description:

  • Start_date is a required argument that characterizes the values of the Date format, which is the starting point (the beginning of an event).
  • Days is a required argument that accepts data of a numeric type, which characterizes the number of working days that have passed since the start of any event or preceding it. It is believed that this number does not contain days that are holidays or weekends. For the countdown relative to the date specified as the first argument, this argument should be rendered as a negative number.
  • [Holidays] is an optional argument that accepts Date data format, indicating one or more dates corresponding to holidays. As an argument, an array of cells can be passed.

WORKDAY.INTL function has the following syntax:

=WORKDAY.INTL(Start_date,Days,[Weekend],[Holidays])

Argument Description:

  • Start_date is a required argument that characterizes the start date of any event in the form of data;
  • Days is a required argument in the form of numerical data characterizing the number of days that precede the start of an event (a negative number) or denote a future date (a positive number);
  • [Weekend] is an optional argument that takes one or more Date values that indicate dates of holidays;
  • [Holidays] — optional argument in the form of a string of 7 consecutively recorded values from the range from 0 to 1, characterizing the number of days off and their position by days of the week, or a numerical value from the range from 1 to 17. Examples of some options for writing this argument:
  1. 1 (or not explicitly specified) — weekends are Saturday and Sunday.
  2. 2 — Sunday and Monday.
  3. 3 — Monday and Tuesday (and so on).
  4. 11 — only Monday.
  5. 12 — only Tuesday (and so on).
  6. «0000011» — Saturday and Sunday.
  7. «1000001» — Sunday and Monday (and so on).

Notes:

  1. When using both of the functions in question, it must be borne in mind that Excel supports dates from January 1, 1900 to December 31, 9999. If the first argument or the date of any holiday is presented as a date that does not belong to the range of valid values, both functions will return a code errors #NUM!
  2. If, as a result of adding the date represented by the first argument of any of the functions in question, as well as the number of days specified by the second argument of the function, taking into account a certain number of holidays and weekends, a value outside the valid date range will be returned, the error code #NUM!
  3. If the “Days” argument is represented as a fractional number, the fractional part will be automatically truncated.
  4. The function WORKDAY.INTL returns the error code #NUM! If a number not in the range of valid values or a string containing invalid characters, only units («1111111») or consisting of less than seven characters was passed as an argument [output].
  5. When entering dates, it is recommended to use not text representations of dates (for example, “February 10, 2017”) as arguments for the functions in question, but functions that return data in format (for example, =DATE(02,10,2017)).

Download examples WORKDAY function to calculate days in Excel

Note: Unlike the WORKDAY function, which provides the ability to specify only the dates of holidays, the WORKDAY.INTL function. Allows you to determine the number of weekends per week and specify which days in the week are the weekend (for example, instead of the usual Saturday and Sunday, you can specify Tuesday and Wednesday).

Get the number of workdays between two given dates

How to Calculate Working Days in Excel

The NETWORKDAYS Function[1] calculates the number of workdays between two dates in Excel. When using the function, the number of weekends are automatically excluded. It also allows you to skip specified holidays and only count business days. It is categorized in Excel as a Date/Time Function. You can use this formula to calculate working days in Excel between two dates.

In finance and accounting, the net workdays function is useful in calculating employee benefits that accrue based on days worked, the number of working days available during a project, or the number of business days required to resolve a ticket raised by a customer, etc.

Formula

=NETWORKDAYS(start_date, end_date, [holidays])

The function uses the following arguments:

  1. Start_date (required argument) – Start_date can either be earlier than end_date, later than end_date, or same as end_date.
  2. End_date (required argument) – The end date.
  3. Holidays (optional argument) – This specifies the list of holidays that should be excluded from the work days calculation. We can enter it as a range of cells that contain the holiday dates (that is F2:F4) or as a list of serial numbers that represent the holiday dates.

It is recommended that the start_date, end_date and [holidays] arguments are entered as either:

  • References to cells containing dates; or
  • Dates returned from formulas.

How to calculate NETWORKDAYS Function in Excel?

Let’s see a few examples to understand how the NETWORKDAYS function to calculate working days in Excel.

Example 1 – Working days between two dates

Suppose we wish to calculate the workdays or business days from January 15, 2017 to January 21, 2018. The holidays in between are:

  1. November 23, 2017 – Thanksgiving Day
  2. December 25, 2017 – Christmas Day
  3. January 1, 2018 – New Year’s Day

To calculate the number of working days, we use the following function:

NETWORKDAYS Function

Using the formula above, we will get the number of working days as 262, as shown below.

NETWORKDAYS Function - Example

Pointers about the NETWORKDAYS function 

  1. Negative return value – If the start date is later than the end date, the function will return a negative value.
  2. The NETWORKDAYS function will include both the start date and end date when calculating work days. So, if we give NETWORKDAYS the same date for start date and end date, it will return 1.
  3. #VALUE! error – Occurs when any of the given arguments is not a valid date.
  4. If we wish to use weekends other than Saturday and Sunday, we need to use the NETWORKDAYS.INTL function.

Click here to download the sample Excel file

Additional Resources

Thank you for reading CFI’s guide on NETWORKDAYS Function. To keep learning and advancing your career, the following resources will be helpful:

  • Excel Functions for Finance
  • Advanced Excel Formulas Course
  • Advanced Excel Formulas You Must Know
  • Excel Shortcuts for PC and Mac
  • See all Excel resources

Calculating the number of days between two dates in Excel is a popular operation performed in different scenarios. 

For example, project managers use it to measure performance against milestones and accountants use it to track aging receivables. 

This tutorial shows you how to calculate the number of days between two dates in Excel in different situations.

How to Calculate the Overall Number of Days Between Two Dates

In this first scenario, I will show you how to calculate the total number of days between two given dates. These would include all days, i.e., working days, weekends, and holidays.

Method #1: Use the Subtraction Method

Excel stores dates as sequential serial numbers.

This allows us to subtract the start date from the end date to get the total number of days between the two dates.

Below I have a data set where I have the start date and the end date, and I’ll create the total number of days between these two dates

Start and End Date dataset

We use the following steps:

  1. Select cell D2 and type in the following formula:
=C2-B2
Subtraction formula to calculate days between two dates
  1. Press Enter on the keyboard or click the Enter button on the Formula Bar.
Enter the formula
  1. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates result
Also read: How to Get Total Days in Month in Excel?

Method #2: Use the DATEDIF Function

The DATEDIF function is a legacy function maintained in Excel for the purpose of compatibility with Lotus 1-2-3.

The function calculates the number of years, days, or months between two dates. When you start to type it in a cell it does not appear as part of IntelliSense and must be entered manually.

Using the dataset in the previous illustration, we proceed as follows:

  1. Select cell D2 and type in the following formula:
=DATEDIF(B2,C2,"d")
DATEDIF formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click or drag down the fill handle to copy the formula down the column.
Days between two dates result

Let me quickly explain how this works.

Below is the syntax of the DATEDIF function

DATEDIF(start_date,end_date,unit)

The DATEDIF function has the following arguments:

  • The start_date is a required argument and stands for the starting date of a given period. In our example, it represents the start date of the project.
  • The end_date is a required argument and stands for the last date of a given period. In our example, it stands for the last date of the project.
  • The unit argument is a required argument, and it stands for the type of data you want the function to return. In our example, we want the function to return the number of days and therefore we use the “d” unit. 

Note: You can also use the DATEDIF function to calculate the total number of months or number of years between two given dates. to do this, instead of using “d”, you can use “m” or “y”

Also read: Calculate Days Left in the Year (Formula)

Method #3: Use the DAYS Function

The DAYS function returns the overall number of days between two date values.

Using the dataset in the previous illustration, we proceed as follows:

  1. Select cell D2 and type in the following formula:
=DAYS(C2,B2)
DAYS formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates result

Below is the syntax of the DAYS function

DAYS(end_date,end_date)

The DAYS function has the following arguments:

  • The start_date. It is a required argument and stands for the starting date of a given period. In our illustration, it represents the start date of the project.
  • The end_date. It is a required argument and stands for the last date of a given period. In our illustration, it stands for the last date of the project.

How to Compute the Overall Number of Workdays Between Two Dates

Operations are normally shut down during weekends. You would want to exclude weekends when figuring out the number of workdays between two dates. 

Below is the data set that I’m going to use for the illustration. It has the start date and the end date, and I want to calculate the total number of working days between these two dates (excluding the weekend dates).

Start and End Date dataset

Method #1: Use the NETWORKDAYS Function to Exclude Saturdays and Sundays

The NETWORKDAYS function returns the number of days between two dates excluding Saturdays and Sundays. It can also optionally exclude specified holidays but we shall illustrate that in the next method.

Below are steps to get the total number of days between two dates while excluding Saturday and Sunday:

  1. Select cell D2 and type in the following formula:
=NETWORKDAYS(B2,C2)
NETWORKDAYS formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates result

Below is the syntax of the NETWORKDAYS function:

NETWORKDAYS(start_date,end_date,[holidays])

The NETWORDAYS function has the following arguments:

  • The start_date. It is a required argument and stands for the starting date of a given period. In our illustration, it represents the start date of the project.
  • The end_date. This argument is a required argument and stands for the last date of a given period. In our illustration, it stands for the last date of the project.
  • The [holidays]. This argument is an optional argument. It represents a range of one or more dates such as federal and state holidays that are excluded from the working calendar. The dates to be excluded can be entered as a named range, a range of cells containing the dates, or a list of serial numbers representing the dates.

Method #2: Use the NETWORKDAYS Function to Exclude Saturdays, Sundays, and Holidays

The NETWORDAYS function by default excludes Saturdays and Sundays in its calculation.

If you want it to also exclude holidays, you have to pass to the function the dates to exclude.

The dates to be excluded can be entered as a named range, a range of cells containing the dates, or a list of serial numbers representing the dates.

Below I have a data set where I have the start date and the end date, and I also have a list of holidays. I want to calculate the total number of days between the start and the end date while excluding the holidays and weekend days.

Start and End Date dataset with holidays

Below are the steps to do this:

  1. Select cell D2 and type in the formula below:
=NETWORKDAYS(B2,C2,$F$2:$F$5)

Note: Press F4 after typing in range F2:F5 to lock it down and make it an absolute reference.

NETWORKDAYS formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates excluding holidays

While the NETWORKDAYS function is already built to take the start date and the end date and give you the total number of days between these two dates while excluding Saturdays and Sundays.

In this above example, we have also used the third optional argument that refers to the dates that are holidays.

So the final result that we get would give us the total number of days between the start date and the end date while excluding the weekend days and the holidays.

In case a holiday occurs on a weekend day, the function is smart enough to only recognize this and not exclude it twice.

Method #3: Use the NETWORKDAYS.INTL Function to Exclude Custom Weekends

One limitation of using the NETWORKDAYS function is that it defaults to excluding Saturday and Sunday.

In some countries or regions, weekends are Fridays and Saturdays or another combination of days.

In other situations, the weekend may be only Sunday or some other day. The NETWORKDAYS.INTL function takes care of such scenarios.

The NETWORKDAYS.INTL function returns the number of days between two dates excluding custom weekends. It can also optionally exclude holidays.

The syntax of the NETWORKDAYS.INTL function:

NETWORKDAYS.INTL(start_date,end_date,[weekend],[holidays])

The function has the following arguments:

  • start_date. It is a required argument. It represents a date value that is the starting date of a given period.
  • end_date. It is a required argument. It represents a date value that is the ending date of a given period.
  • [weekend]. It is an optional argument. It specifies the days of the week that are weekend days. The days can be specified by a weekend number or a string that shows when weekends occur. If this argument is omitted, the weekend days of Saturday and Sunday are assumed.

The weekend numbers range from 1 to 17. Each number represents a weekend day or weekend day.

NETWORKDAYS.INTL weekend argument
NETWORKDAYS.INTL weekend argument 2
  •  [holidays]. It is an optional argument. It represents a range of one or more dates such as federal and state holidays that are excluded from the working calendar. The dates to be excluded can be entered as a named range, a range of cells containing the dates, or a list of serial numbers representing the dates.

We give an example of calculating the number of working days between two dates excluding Friday and Saturday as weekend days.

We use  the following dataset:

Start and End Date dataset

We use the steps below:

  1. Select cell D2 and type in the formula below:
=NETWORKDAYS.INTL(B2,C2,7)

Note: The third argument is weekend number 7 which represents the weekend days of Friday and Saturday.

NETWORKDAYS.INTL formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates result excluding Fridays and Saturdays

The above formula gives us the total number of days between the start and the end date, while excluding all the Fridays and Saturdays.

Method #4: Use the NETWORKDAYS.INTL to Exclude Custom Weekends and Holidays

The NETWORKDAYS.INTL function returns the number of days between two dates excluding custom weekends. It can also optionally exclude holidays.

We give an example of calculating the number of working days between two dates excluding the weekend days of Wednesday and Thursday and holidays in a given range.

We use the following dataset:

Start and End Date dataset

We use the following steps:

  1. Select cell D2 and type in the following formula:

=NETWORKDAYS.INTL(B2,C2,5,$F$2:$F$5)

NETWORKDAYS.INTL formula
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Days between two dates result

The above formula gives us the total number of days between the start and the end date, while excluding the days that occur on Wednesdays and Thursdays and holidays

How to Calculate the Number of Custom Workdays Between Two Dates

We can use the NETWORKDAYS.INTL function to calculate the number of custom workdays between two dates.

Custom workdays could be the number of days one works at a part-time job.

Method #1: Use the NETWORKDAYS.INTL Function to Calculate the Number of Part-time Workdays

We give an example of calculating the number of custom workdays between two dates where an employee works part-time at a job on Mondays and Fridays only.

The dataset below is used in our example:

Start and End Date dataset
  1. Select cell D2 and type in the following formula:
=NETWORKDAYS.INTL(B2,C2,"0111011")

Note: Instead of entering a weekend number in the third argument, we enter a string of seven characters. Each character stands for a day of the week beginning with Monday. Character 1 stands for a non-workday and 0 represents a workday. Therefore “0111011” represents the workdays of Monday and Friday.

NETWORKDAYS.INTL formula with custom days argument
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Part-time Days between two dates result

Note: If we have holidays we want to be excluded from the number of part-time workdays, we can pass the days to the function as the fourth argument.

Method #2: Use NETWORKDAYS.INTL Function to Calculate the Number of Fridays (or any other day) Between Two Dates

We can use the NETWORKDAYS.INTL function to calculate the number of specified days of the week between two dates.

Suppose we want to find out the number of Fridays between two dates. We use the following dataset to explain how this can be achieved.

Start and End Date dataset

We use the steps below:

  1. Select cell D2 and type in the following formula:
=NETWORKDAYS.INTL(B2,C2,"1111011")

Note: Instead of entering a weekend number in the third argument, we enter a string of seven characters. Each character stands for a day of the week beginning with Monday. Character 1 stands for a non-workday and 0 represents a workday. Therefore “1111011” represents the workday of Friday.

Formula to get number of Fridays between two dates
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Fridays between two dates result

Note: The logic behind the argument of the seven-character string can be applied to calculate the total number of any other day between two dates.

How to Compute the Overall Number of Weekend Days Between Two Dates

Sometimes we may want to find out the number of weekend days between two dates. 

We can use the combination of the DAYS function and the NETWORKDAYS function to calculate the number of weekend days between two dates.

The syntax of these two functions and their arguments have been explained previously in this tutorial.

The dataset below is used in our illustration:

Start and End Date dataset

We proceed as follows:

  1. Select cell D2 and type in the following formula:
=DAYS(C2,B2)+1-NETWORKDAYS(B2,C2)

Note: We add 1 to the days returned by the DAYS function so as to include both the start date and the end date. 

The logic of the formula is that the total number of workdays between two dates is subtracted from the total number of days between the two dates (the start date and end date inclusive).

The result is the number of weekend days between the two dates. 

Formula to get number of weekend days between two dates
  1. Press Enter key on the keyboard or click the Enter button on the Formula Bar.
  2. Double-click the fill handle or drag down the fill handle to copy the formula down the column.
Total weekend days

In this tutorial, I showed you different scenarios where you can use different formulas to calculate the number of days between two given dates.

I covered how you can calculate the total number of days between us start and the end date, or you can calculate only the working days using functions such as NETWORKDAYS and NETWORKDAYS.INTL.

I also covered how to calculate the number of working days when you’re in a part-time job, or you want to only calculate the number of specific days between the two dates (such as the number of Fridays or the number of Mondays between two given dates).

Other articles you may also like:

  • How to Calculate the Number of Months Between Two Dates in Excel?
  • How to Change Date and Time to Date in Excel (4 Easy Ways)
  • Find Last Monday of the Month Date in Excel (Easy Formula)
  • Using IF Function with Dates in Excel (Easy Examples)
  • How to Convert Days to Years in Excel (Simple Formulas)
  • How to Convert Date to Day of Week in Excel (3 Easy Ways)
  • How to Add Days to a Date in Excel

When calculating the difference between two dates, you may want to exclude weekends and holidays.

For example, you might want to know how many business days are in November 2015. This
calculation should exclude Saturdays, Sundays, and holidays.

The NETWORKDAYS function calculates the difference between two dates, excluding weekend
days (Saturdays and Sundays).

Number of days in Excel 2016

As an option, you can specify a range of cells that contain the dates of holidays, which are also
excluded. Excel has absolutely no way of determining which days are holidays, so you must provide this
information in a range.

Number of days in Excel 2016

See also
Calculating the number of work days between two dates for unusual shifts and
How to calculate the number of work days for a four-day workweek.

See also this tip in French:
Calculer le nombre de jours ouvrés entre deux dates.

Please, disable AdBlock and reload the page to continue

Today, 30% of our visitors use Ad-Block to block ads.We understand your pain with ads, but without ads, we won’t be able to provide you with free content soon. If you need our content for work or study, please support our efforts and disable AdBlock for our site. As you will see, we have a lot of helpful information to share.

Calculating the number of workdays between two distinct dates can be a pain to do, manually. However, Excel has a great function that will help you accomplish this. It involves using the NETWORKDAYS function.

Follow the steps below:

  1. Click inside the cell where the formula will reside.
  2. Type =networkdays(
  3. Then type in the first date of the range encased in «». For example «4/6/2012».
  4. Then type a comma and the end date of the range encased in quotes.
  5. Close your parenthis and hit enter.

Your formula should look like this.

Excel formula for networkdays

If you’d like to add in holidays add them as a new condition in {}. For example =NETWORKDAYS(«4/6/2012″,»12/31/2012», {«7/4/2012», «12/25/2012»). Should you have a long list of holidays type them in a list somewhere in your spreadsheet and refer to that cell range in the formula. For example =NETWORKDAYS(«4/6/2012″,»12/31/2012», J1:J12).

Did you find this useful? You’ll be amazed at what you can learn when you watch our free video “10 Microsoft Excel AHA! Moments.”

We offer Microsoft 365 training. Learn more.

Watch video on 10 Microsoft Excel AHA Features

Понравилась статья? Поделить с друзьями:
  • Work application form word
  • Work and jobs use a word from the box
  • Words with the word tune in it
  • Words with the word tired in them
  • Words with the word pad in it