Calculate days between two dates

Calculating the number of days between two days is easy and pretty straightforward. You have to subtract an older date from the newer.

Here’s how it works.

You have two dates:

2015-12-14
2018-06-09

The first date is older than the second date, therefore you subtract the first date from the second one.

Number of days = 2018-06-09 - 2015-12-14

The number of days between these two dates is 908.

You can use this simple arithmetical operation because dates in Excel are stored as numbers and not dates.

If you select both dates, do right-click and choose Format Cells … from the contextual menu.

Inside the Format Cells window, choose the following options.

You can set decimal places to 0 because days are represented as integers. Also, add the thousands separator for readability.

After you press OK, inside formatted cell dates are now displayed as numbers.

If you subtract lower number from the bigger, you are going to get 908 days.

You can modify the formula to:

=ABS(A1-B1)

Let’s use the ABS function to return the absolute value.

Now, even if you subtract a higher number from the lower one you will always get a positive number.

Count the number of days using a function

You can subtract one date from the other by using simple arithmetical operations, but there is another, probably more elegant way.

You can calculate the number of days with the DAYS function.

This formula shows how you can do it.

=DAYS(A1,B1)

With this formula, you can also get negative values. Let’s fix this problem.

=ABS(DAYS(B1,A1))

The other function, that is similar to DAYS is DAYS360.

This function treats a year as 12 30-day months = 360 days.

Let’s try this formula.

As you can see the number is somewhat smaller.

Count only the working days

The NETWORKDAYS function counts only the working days, and it has the following syntax.

NETWORKDAYS (start_date, end_date, [holidays])

Let’s try it using our example.

=NETWORKDAYS(B1,A1)

This formula will return 650, as the number of working days. You can add your own list of free days as the third optional parameter. If a day on the list is a working day the number will be smaller if the day is a holiday it will be ignored.