Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Excel Formula to Count Days from Date

When working with dates, we often need to calculate the Number of days between two dates. In the past, people used to calculate it manually. But at present with the advancement of modern tools, it is very easy to calculate it using these modern tools. Here I will be showing some easy ways to calculate the number of days between two days using Microsoft Excel.

Download Practice Workbook

: https://www.exceldemy.com/excel-formula-to-count-days-from-date-3/

How to Add Dates in Excel

Excel has built in formats for writing any date inside it. If you do not know it, just click any cell and write any date inside it, in our conventional way, DD/MM/YYYY. Like I have written 09/03/2011.

Now select it and go to the Home > Number  section in the Excel Toolbar. You will see the Date option is automatically selected there by Excel.

If you want to change the format, select the dropdown menu with it. You will get quite a few options like General, Number, Currency, Percentage etc. Select the last option, More Number Formats. You will get a dialogue box like this.

Now you see under the Type menu, there are various sorts of Date Format. Click on the one you like. Then click OK. Here I am choosing the one, March 14, 2012.

In this way, you can write Date in any desired format in Excel.

Excel Formula to Count Days from Date

Let us have a data set like this. We have the employee record of a company named Tata Group. We have the Employee Names, Their Starting Dates and Ending Dates in column A, B and C respectively.

Now the CEO of the company wants to find out the number of total days each employee worked. How can he find this out? Here I am showing the ways.

1. Counting Days by Normal Subtraction

First of all, select a column where you want to have the total days. Then select the first cell of it. Here I have selected column D and named it as Total Days. Then selected the first cell of it, D4.

Then write the general subtraction formula =Ending Date – Starting Date. Then click Enter. Here I am writing =C4 – B4.

See Excel has calculated the total number of days between the two days, 3179.

Now to find out the total days of all the employees, drag the Fill Handle (Small Plus (+) Sign on the bottom right corner) or double click it. You will find all the cells filled with the formula and having the number of days.

2. Counting Days by Excel’s DAYS Function

Excel provides a built-in Function called DAYS. It takes two arguments, the Ending Date and the Starting Date. And gives the total number of days in between as the output.

Again select the first cell of the column where you want to have the total days. Then write down the formula. Then click Enter. Here I am again selecting D4 and writing =DAYS(C4,B4)

See I have got the number of days, 3349. Now like the previous one, drag the Fill Handle and fill all the cells of the column with the formula.

Note: DAYS Function is available from Excel 2013. Users of previous versions will not find this.

3. Counting Days by Excel’s DATEDIF Function

DATEDIF (Starting Date, Ending Date, “d”)

It calculates the number of days between two dates, just like the DAYS Function. Only one difference, it takes Starting Date as the first argument, while DAYS takes Ending Date first.

DATEDIF (Starting Date, Ending Date, “m”)

It calculates the number of months between two days.

DATEDIF (Starting Date, Ending Date, “y”)

It calculates the number of years between two days.

DATEDIF (Starting Date, Ending Date, “yd”)

It calculates the number of days between two dates neglecting the years. That means, it counts days of the same year.

For example, if we take the Starting Date as June 11, 2012 and the Ending Date as September 22, 2020. It will count only the number of days between June 11, 2012 and September 22, 2012.

DATEDIF (Starting Date, Ending Date, “ym”)

It calculates the number of months between two dates neglecting the years.

DATEDIF (Starting Date, Ending Date, “md”)

It calculates the number of days between two dates neglecting the months and years.

Note: DATEDIF is a hidden function in Excel. You will not find it anywhere in Excel Toolbar. You have to write the full name in the cell or Formula Bar to get it.

4. Counting Work Days by Excel’s NETWORKDAY Function

Now we will count the total number of workdays between two days. For this, we will use two functions.

  1. NETWORKDAYS
  2. NETWORKDAYS.INTL

4.1 NETWORKDAYS

It takes three arguments, the Starting Date, the Ending Date and a list of Non – Working Days or Holidays. Also it takes Saturday and Sunday of each week as Weekends. It then gives the number of total Working Days as output. Look at the image below. I have made a list of all holidays of a year in column F.

Then I entered the formula in cell D4 =NETWORKDAYS(B4,C4,$F$4:$F$17). We get the total Work Days as 2272 days. Then dragged the Fill Handle to fill the rest of the cells.

Note: We have used the Absolute Cell Reference of the list of holidays, because we do not want it to be changed while dragging the Fill Handle. 

4.2 NETWORKDAYS.INTL

The only difference between NETWORKDAYS and NETWORKDAYS.INTL is that in NETWORKDAYS, the weekend holidays are fixed as Saturday and Sunday. But in NETWORKDAYS.INTL you can take it as you wish.

So NETWORKDAYS.INTL has four arguments, the Starting Date, the Ending Date, a Weekend Number and a list of Holidays. The Weekend Numbers are fixed in Excel. In the image below, the columns H and I contain the list of the Weekend Numbers.

Let us think for a moment that in Tata Group, the weekly holidays are given to Friday and Saturday. So the Weekend Number is 7.

Now I go to column D and insert this formula in cell D4. D4 =NETWORKDAYS.INTL(B4,C4,7,F4:F16). Then I click Enter. Then I drag the Fill Handle through the column and get the total number of Working Days of each employee.

Note: We have again used Absolute Cell Reference for the list of Holidays, because we do not want it to increase while dragging the Fill Handle.

Conclusion

Using the above methods, we can comfortably calculate the number of days or workdays between any two dates using Microsoft Excel. Do you know any other method? Let us know in the comment section.

The post Excel Formula to Count Days from Date appeared first on ExcelDemy.



This post first appeared on ExcelDemy.com, please read the originial post: here

Share the post

Excel Formula to Count Days from Date

×

Subscribe to Exceldemy.com

Get updates delivered right to your inbox!

Thank you for your subscription

×