To calculate the number of days between two dates in Excel, use a simple subtraction formula. Excel stores dates as serial numbers, so subtracting one date from another returns the exact number of days between them. No add-ins or special functions are required—this works in all modern versions of Excel on Windows, Mac, or web.

What You'll Need

  • A spreadsheet with at least two cells containing valid dates
  • Excel installed (desktop, web, or mobile app)
  • Basic familiarity with entering formulas in Excel cells

Step-by-Step

  1. Open your Excel workbook and ensure the two dates you want to compare are in separate cells. For example, enter "1/15/2024" in cell A2 and "3/22/2024" in cell B2. Make sure the cells are formatted as dates—Excel will usually auto-detect this when you type a recognizable date format.
  2. Click on a blank cell where you want the result to appear, such as C2. This is where the day difference will display.
  3. Type the formula: =B2-A2. Do not include quotes. This subtracts the earlier date from the later one. The order matters: always subtract the start date from the end date to get a positive result.
  4. Press Enter. Excel will calculate and display the number of days between the two dates—in this case, 66.
  5. If the result appears as a date instead of a number, select the cell with the formula, right-click, choose "Format Cells," then select "General" under the Number tab. This ensures the result displays as a whole number, not as a date serial.
  6. To calculate multiple date pairs, drag the fill handle (small square at the bottom-right corner of the cell with the formula) down to copy the formula to other rows. Excel will automatically adjust the row numbers in the formula (e.g., =B3-A3, =B4-A4, etc.).
  7. If your dates are in different columns, adjust the cell references accordingly. For example, if your start date is in D5 and end date is in F5, use =F5-D5.

Common Mistakes

  • Subtracting in the wrong order: If you type =A2-B2 when A2 is the earlier date, you’ll get a negative number. Always subtract the earlier date from the later one to avoid confusion.
  • Using text instead of actual dates: If a cell shows a date but Excel treats it as text (left-aligned instead of right-aligned), the formula will return a #VALUE! error. Check by selecting the cell—look at the formula bar. If the date appears as text like "January 15, 2024" instead of a number, convert it using DATEVALUE or re-enter it as a valid date (e.g., 1/15/2024).
  • Formatting the result as a date: If the cell with your formula is formatted as a date, Excel will display the serial number as a date (e.g., 66 becomes 2/5/1900). Always format the result cell as "General" or "Number".
  • Including time values without accounting for them: If your dates include time (e.g., 1/15/2024 14:30), Excel still calculates correctly, but the result might show decimals (e.g., 66.43). To get whole days only, wrap the formula in INT(): =INT(B2-A2).

Tips

  • Use the TODAY() function to calculate days from today: =TODAY()-A2 gives you how many days have passed since the date in A2. This is useful for tracking deadlines or aging invoices.
  • For absolute differences (ignoring negative results), use ABS(): =ABS(B2-A2). This ensures the result is always positive, regardless of which date is entered first.
  • Combine with conditional formatting to highlight dates that are more than 30 days apart: Select your results column, go to Home > Conditional Formatting > New Rule > Use a formula, then enter =C2>30 and choose a highlight color.
  • For date ranges spanning years, the formula works the same—Excel handles leap years and month lengths automatically.
  • To include both start and end dates in the count (e.g., 1/1 to 1/3 = 3 days), add 1 to the formula: =B2-A2+1.

Troubleshooting

  • #VALUE! error: This means one or both cells contain text that Excel can’t interpret as a date. Check the cell formatting. Try typing the date again in a new cell using the format MM/DD/YYYY or DD/MM/YYYY depending on your regional settings. Alternatively, use =DATEVALUE(A2) to convert text to a date, then subtract.
  • #REF! error: You’ve referenced a cell that no longer exists, often because you deleted a row or column. Check the formula in the result cell and correct the cell references.
  • Result shows as a date: Format the cell as General. Right-click the cell > Format Cells > Number > General > OK.
  • Formula doesn’t copy properly: When dragging the fill handle, ensure you’re dragging the cell with the formula, not just the result. If it doesn’t update, check if the cells are locked (Review > Protect Sheet) or if Excel is in manual calculation mode (Formulas > Calculation Options > Automatic).
  • Formula returns 0: Verify both cells contain actual dates—not blank cells or identical dates. Use =ISTEXT(A2) or =ISNUMBER(A2) to test if a cell contains a true date value.

Frequently Asked Questions

Can I calculate days between dates in Excel without using a formula?

No, Excel doesn’t have a built-in button or menu option to calculate days between two dates. You must use a formula, but it’s as simple as subtracting one cell from another.

Does the formula work with dates from different years?

Yes. Excel’s date system counts every day sequentially, regardless of year. Subtracting December 1, 2022 from January 15, 2025 will correctly return 776 days.

Why is my result showing as a decimal?

This happens when your dates include time values (e.g., 2:30 PM). Excel stores time as fractions of a day. To get whole days only, wrap your formula in INT(), like =INT(B2-A2).

Can I calculate days between today and a future date?

Yes. Use =FutureDateCell-TODAY(). For example, if your target date is in B2, use =B2-TODAY(). This will show positive numbers for future dates and negative for past ones.

What if one of the cells is empty?

If either cell is blank, Excel treats it as zero, which equals December 30, 1899. This will give you a huge, incorrect number. Always ensure both cells have valid dates before applying the formula.

Can I use this formula in Excel Online or mobile apps?

Yes. The formula works identically in Excel for the web, iOS, and Android. Cell references and basic arithmetic functions are fully supported across all platforms.