To calculate the number of days between two dates in Excel, subtract the earlier date from the later one: enter =B2-A2 (where A2 is the start date and B2 is the end date) and format the result as a number. The result is the count of days between them. If you need only working days, use =NETWORKDAYS(A2,B2) instead. This guide walks through the exact steps, the common traps that produce wrong answers, and how to fix them.

What You'll Need

  • Excel on Windows, Mac, or Excel for the web (the steps below are for the desktop app; the web version works the same for these formulas).
  • Two dates you want to compare, ideally in separate cells.
  • Basic familiarity with typing a formula into a cell and pressing Enter.

Menu labels can differ slightly by Excel version, device, and region, so if a button name does not match exactly, look for the closest equivalent.

Step-by-Step

  1. Enter your dates in two cells. Put the start date in A2 and the end date in B2. Type them in a format Excel recognises, such as 1/15/2025 or 2025-01-15. If Excel treats the entry as text (it will sit on the left side of the cell instead of the right), the formula will return an error later.
  2. Select an empty cell for the result, for example C2.
  3. Type the subtraction formula: =B2-A2 and press Enter. The cell shows a number. If it shows a date instead, move to the next step.
  4. Format the result as a number. Select the result cell, then on the Home tab open the number format dropdown (it may say General or Date) and choose Number. Alternatively, right-click the cell, choose Format Cells, pick Number, and set decimal places to 0.
  5. Check the sign. If the result is negative, the start date is later than the end date. Swap the cell references so the earlier date comes first, or wrap the formula in ABS: =ABS(B2-A2).
  6. For working days only, use NETWORKDAYS. Type =NETWORKDAYS(A2,B2). This counts Monday to Friday between the two dates, including both the start and end date. To exclude holidays, list them in a separate range (say E2:E10) and use =NETWORKDAYS(A2,B2,E2:E10).
  7. Fill the formula down if you have a list of date pairs. Drag the small square at the bottom-right corner of the result cell down the column, or double-click it to fill to the end of the adjacent data.
  8. Verify one row by hand. Pick a pair you can count yourself, such as 1 January to 10 January, which should return 9 with the plain subtraction formula. If it returns 10, you are likely using a formula that includes both endpoints (NETWORKDAYS does; plain subtraction does not).

Common Mistakes

  • Dates stored as text. If a date was imported or typed with an unusual separator, Excel may keep it as text. Subtraction then returns #VALUE!. Fix it with Data > Text to Columns, or re-enter the date in a recognised format.
  • Result formatted as a date. Subtracting two dates gives a serial number, but Excel sometimes inherits date formatting and displays something like 1/9/1900. Changing the format to Number fixes it.
  • Reversed order. End minus start is correct; start minus end gives a negative number.
  • Expecting NETWORKDAYS to exclude the endpoints. It includes both the start and end date. If you want to exclude them, subtract 1 from the result.
  • Forgetting holidays. NETWORKDAYS counts public holidays as working days unless you supply a holiday range.
  • Copying formulas without checking references. Relative references shift when filled; use $ (for example $E$2:$E$10) to lock a holiday list.

Tips

  • Use =DATEDIF(A2,B2,"d") for whole days, "m" for complete months, or "y" for complete years. DATEDIF is an older function and is not listed in Excel's function suggestions, but it still works.
  • For a count that includes both the start and end date with plain subtraction, add 1: =B2-A2+1.
  • Name your holiday range (Formulas > Define Name) so formulas read more clearly.
  • Keep dates in genuine date cells rather than text, and use a consistent format across the sheet.
  • If you need the result in weeks, divide by 7 and format to one or two decimal places.

Troubleshooting

  • #VALUE! error: one or both cells contain text, not a date. Check by selecting the cell and looking at the alignment and the formula bar. Re-enter the date or convert it with Text to Columns.
  • Result looks like a date: change the number format to General or Number.
  • Result is zero: the two cells hold the same date, or one of them is blank.
  • Result is negative: the dates are in the wrong order for your intended calculation.
  • NETWORKDAYS returns an unexpected count: confirm the holiday range covers the right cells and that the holidays are real dates, not text.
  • Formula shows as text: the cell is formatted as Text. Format it as General, then re-enter the formula.

Frequently Asked Questions

Does the subtraction formula include both dates?

No. =B2-A2 counts the days between the dates, not including the start date. Add 1 if you want both endpoints counted.

How do I count only business days?

Use =NETWORKDAYS(A2,B2), and add a holiday range as a third argument if needed. It counts Monday to Friday and includes both endpoints.

Why does my result show a date instead of a number?

The cell inherited date formatting. Change the number format to Number or General.

Can I calculate months or years between dates?

Yes, with =DATEDIF(A2,B2,"m") for complete months or "y" for complete years.

What if my dates are text?

Convert them first with Data > Text to Columns, or retype them in a format Excel recognises. Subtraction will not work on text dates.

Does this work in Excel for the web?

Yes, the same formulas and number formatting work in the web version, though menu locations may differ slightly.