To find the difference between two dates in Excel, the fastest method is to subtract the start date from the end date using a simple formula: =End_Date - Start_Date. Because Excel stores dates as sequential serial numbers, subtracting one from another returns the total number of days between them. For more complex calculations, such as finding the exact number of months or years, the DATEDIF function is the most effective tool.

What You'll Need

  • Microsoft Excel (any modern version)
  • A dataset containing at least two columns of dates
  • Dates formatted correctly as "Date" cells, not as "Text"

Step-by-Step

  1. Enter Your Dates: Input your start date in one cell (e.g., A2) and your end date in another cell (e.g., B2). Ensure the end date is later than the start date to avoid negative numbers.
  2. Select the Result Cell: Click on the cell where you want the difference to appear (e.g., C2).
  3. Apply Simple Subtraction: Type the formula =B2-A2 and press Enter. This will give you the total number of calendar days between the two dates.
  4. Adjust Cell Formatting: If the result appears as a date (e.g., "Jan 15, 1900") instead of a number, go to the Home tab, locate the Number group in the ribbon, and change the dropdown menu from "Date" to "General" or "Number."
  5. Use DATEDIF for Specific Units: If you need the difference in months or years rather than days, use the DATEDIF function. Type =DATEDIF(A2, B2, "unit"). Replace "unit" with one of the following:
    • "d" for total days.
    • "m" for total complete months.
    • "y" for total complete years.
    • "md" for the difference in days, ignoring months and years.
    • "ym" for the difference in months, ignoring days and years.
  6. Fill the Formula Down: Click the small green square (fill handle) at the bottom-right corner of the result cell and drag it down to apply the calculation to the rest of your data rows.

Common Mistakes

  • Wrong Date Order: Placing the start date after the end date in a subtraction formula results in a negative number. In the DATEDIF function, placing the start date after the end date will result in a #NUM! error.
  • Text Formatting: Entering dates as text (e.g., typing "Oct 12th 2023" instead of "10/12/2023") prevents Excel from recognizing the cell as a number, leading to a #VALUE! error.
  • Including the Start Day: Simple subtraction calculates the difference. If you need to include the start day in your count (e.g., for a project duration where Day 1 counts), you must add 1 to your formula: =(B2-A2)+1.

Tips

  • Dynamic Dates: Use the =TODAY() function as one of your dates to calculate the number of days elapsed from a past date to the current day automatically.
  • Networkdays: To calculate only business days (excluding weekends), use the =NETWORKDAYS(start_date, end_date) function. You can also add a range of holiday dates as a third argument to exclude them.
  • Absolute References: If you are comparing a list of dates against one single fixed date, use dollar signs to lock that cell (e.g., =B2-$F$1) so the reference doesn't shift when you drag the formula down.

Troubleshooting

If your formula is not working as expected, try these steps in order:

  1. Check for #VALUE! Errors: This usually means one of your dates is stored as text. Select the date column, go to the Data tab, select Text to Columns, and click Finish immediately. This often forces Excel to re-evaluate text as dates.
  2. Check for #NUM! Errors: Ensure the start date is chronologically before the end date. DATEDIF cannot calculate "backward" time.
  3. Verify Cell Formatting: If the answer looks like a weird date (e.g., 1/05/1900), it is because Excel is trying to be helpful by applying the date format of the source cells to the result. Change the format to General.
  4. Check for Hidden Spaces: Sometimes imported data has leading or trailing spaces. Use the =TRIM() function to clean the cells if they aren't being recognized as dates.

Frequently Asked Questions

Why does my result look like a date instead of a number?

Excel sees that you are using dates in your formula and automatically formats the result cell as a date. Change the cell format to "General" or "Number" via the Home tab to see the actual number of days.

How do I calculate the difference in working days only?

Use the =NETWORKDAYS(start_date, end_date) function. This automatically removes Saturdays and Sundays from the count.

Can I calculate the difference between a date and a time?

Yes. Since Excel treats 1 day as the integer 1 and time as a decimal, you can subtract them. To get the result in hours, subtract the cells and multiply the result by 24.

What is the difference between subtraction and DATEDIF?

Subtraction always gives you the total number of days. DATEDIF allows you to isolate specific time units, such as just the months or just the years, which is useful for calculating ages or tenure.

Does DATEDIF appear in the Excel formula autocomplete list?

No. DATEDIF is a "compatibility function" kept for legacy reasons. You will not see it suggested as you type, but it still works perfectly if you type the full name and open the parenthesis.