If you want to know how to subtract dates in Excel, you need to know that there are two formulas. This segment of your Excel training will teach them both to you. The first is the days formula located under the date & time button in the formulas tab. This formula will only yield the number of days.
The second formula, datedif, may also be used to find the exact number of days, but will also yield the number of months or years between two dates. One very important difference between the formulas is that the days formula will list the end date first whereas the datedif range begins with the start date. Shown below
are the two formulas being used to find the exact number of days between August 15th and September 15th. It will be important to keep both of these in mind as you progress through this Excel tutorial.
The days formula is written as =DAYS(End_Date,Start_Date) and is the quickest and easiest way to find the exact number of days or weeks (divide 7 into the results to get a week count). The dates can be formatted as short date (1/1/17) or long date (Sunday, January 1, 2017). The formula will work either way and the result will be the same.
To change the format of the dates, quickly go to the Home tab in the ribbon to find the box and change the formatting with the drop-down menu as shown to the right.
Tip: Make sure the cell that you enter the formula into is formatted to be either general or number otherwise it will list the date code for the numeric value. (ex: The above dates will result in 12/29/1900 as the answer until you change the formatting).
The datedif formula is a slightly hidden formula within Excel and is written as:
The interval can be either days, months, or years. All accepted codes that may be input as intervals by Excel are as follows:
- d = days
- m = months
- y = years
- ym = number of months between two days while ignoring the year
- yd = number of days between two dates while ignoring the year
- md = number of days between two dates while ignoring the year. This is not a recommended interval as it has many issues that result in negative numbers, a zero or inaccurate results.
You may have seen similar lists in other segments of my online Excel classes, as the program uses roughly the same guidelines in most of its date-specific functions to code the days, months, and years on Excel.
Using all working integrals and the same date range gives the best example of how these integrals work within the formula. B2 shows there are 433 days between January 1, 2017 and March 30, 2018. But look at B6 – while ignoring the year it results in 88 days between January 1st and March 30th. B3 shows the difference as 14 months and combining B4 and B5 shows the dates are 1 year and 2 months apart.
How To Subtract Dates In Excel And Get An Exact Figure
You can learn how to subtract dates in Excel and return the exact years, months and days between the two dates with use of the ampersand. Continue reading this Excel training article to understand how this is done.
The three formulas used are the datedif using “y” integral and “ym”. The third is the date formula that calculates the difference between the end date and the first day of that month. To combine all three formulas, enter an ampersand followed by the description in quotations, then another ampersand and the next formula. You see that adding “years”, “months”, and “days” into the formulas tells Excel exactly what the labels should be named within the results (B6). If you want to separate them with commas and spaces enter the commas and spaces into the quotation, “years, “.
Combining the two formulas creates a continuous countdown towards a specific date. This is an incredibly important feature in our online Excel course. Let’s start a countdown to April 15th of next year.
The result as of today (8/14/17) is 244 days until the close of tax season next year. Tomorrow the worksheet will say 243 because using NOW as the end date will continuously change the formula to the present day.
A few uses of the datedif and days formulas could be knowing how many months or days are left on a warranty, allocating depreciation, calculate the age of a company using its incorporation date and, of course, as a countdown to holidays.
Learn to Subtract Dates with Further Excel Training
If you would like to know more about how to subtract dates in Excel, consider taking Excel training with us. Understanding the length of time between two dates is important, as we count down to tons of events in our lives. Our beginner and advanced Excel classes will show you how to get the most out of every function that you learn with us.