Subtracting one date cell from another in Excel gives you the number of days between them. Put your start date in A2 and your end date in B2, then type =B2-A2 into another cell and press Enter. Excel returns the difference as a plain number of days. That single formula covers most situations, and everything else in this guide is about formatting the result, excluding weekends or holidays, or getting a day count from a text label like "today" or a month name.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, 2019, 2016, or Excel for Mac. The functions below (DATEDIF, NETWORKDAYS, WORKDAY) behave the same across these versions.
  • Two dates entered in separate cells. They must be real dates, not text that looks like a date.
  • Optional: a list of holiday dates in their own cells if you want to exclude public holidays.

Step-by-Step

  1. Enter the dates properly. Type the start date into A2 and the end date into B2, using a format Excel recognizes for your region (for example 12/31/2026 in the US, or 31/12/2026 in much of the rest of the world). Watch that the values align to the right edge of the cell. Left-aligned entries are usually text and will break the formula.
  2. Write the subtraction formula. Click an empty cell such as C2 and type =B2-A2. Press Enter. The result is a whole number of days. If B2 is later than A2 you get a positive number; if it is earlier you get a negative one.
  3. Check the result isn't formatted as a date. If C2 displays something like "1/15/1900" instead of a number, Excel applied date formatting to a number it read as a serial date. Select C2, go to the Home tab, open the number format dropdown in the Number group, and choose General or Number.
  4. Decide how you want to count the endpoints. =B2-A2 counts elapsed days, so A2 = 1 January and B2 = 3 January gives 2. If you need to include both the first and last day, use =B2-A2+1, which gives 3. Pick one convention and stay consistent across your workbook.
  5. Use absolute cell references if you're filling down. If you copy the formula down a column, change it to =$B2-$A2 or lock only what needs locking (F4 toggles the dollar signs). Plain references shift with every row and will pull the wrong cells.
  6. Add a DATEDIF alternative for whole units. The hidden function =DATEDIF(A2,B2,"d") also returns days, and changing the third argument to "m" or "y" gives complete months or years. Note the argument order: DATEDIF takes the start date first, unlike subtraction.
  7. Exclude weekends with NETWORKDAYS. =NETWORKDAYS(A2,B2) counts only Monday to Friday and includes both endpoints. To skip holidays too, list the holiday dates in a range such as F2:F10 and use =NETWORKDAYS(A2,B2,F2:F10).
  8. Count days from today automatically. Replace one date with the TODAY function: =TODAY()-A2 gives days elapsed since the date in A2, and =B2-TODAY() gives days remaining until a deadline. The result updates each time the workbook recalculates.
  9. Handle future or past dates with a clean label. Wrap the formula in IF to avoid confusing negative numbers: =IF(B2>=A2,B2-A2,"End before start"). Adapt the message to whatever your sheet needs.
  10. Format the answer for people, not just cells. To show "45 days" rather than a bare 45, use a custom number format. Select the cell, press Ctrl+1 (Cmd+1 on Mac), choose Custom, and enter 0 "days". The underlying value stays numeric, so later calculations still work.

Common Mistakes

  • Dates stored as text. Typing an apostrophe before a date, importing from a CSV, or copying from a website can leave the value as text. Subtraction then returns #VALUE!. Test with =ISNUMBER(A2) — it should return TRUE.
  • Reversing DATEDIF arguments. Subtraction wants end minus start; DATEDIF wants start first, end second. Mixing them up gives #NUM! or a wrong count.
  • Assuming NETWORKDAYS counts every working day. It supports a standard Monday-to-Friday week out of the box. Non-standard weeks need NETWORKDAYS.INTL, which takes a weekend pattern argument.
  • Forgetting that TODAY and NOW are volatile. They recalculate constantly, so a saved figure can change between sessions. Paste values if you need a fixed snapshot.
  • Formatting as date by accident. A cell that previously held a date keeps that format when you type a formula into it. Reset the number format before blaming the formula.
  • Mixing regional date settings. A sheet authored with month-first dates can flip day and month when opened in another locale, silently shifting counts by days.

Tips

  • Press Ctrl+; (semicolon) to insert today's date as a static value, and Ctrl+Shift+; to insert the current time.
  • Use =B2-A2 with both cells formatted as dates and the result formatted as General — that separation makes errors obvious at a glance.
  • Name your holiday range (Formulas tab > Define Name) so formulas read =NETWORKDAYS(A2,B2,Holidays) and stay readable.
  • For a duration including time, keep the dates with times and multiply the difference by 24 to get hours. Format the result as General, not as a date.
  • Use conditional formatting to highlight rows where the day count exceeds a threshold, such as overdue invoices or expiring certificates.
  • On Mac, keyboard shortcuts use Cmd where Windows uses Ctrl, and the ribbon paths sit under the same tabs but may be arranged slightly differently.

Troubleshooting

You see #VALUE! — At least one cell holds text. Check with =ISNUMBER(), then convert with Data > Text to Columns (choose the date format on the third screen) or re-enter the date without an apostrophe.

You see a date instead of a number — The cell is formatted as a date. Change the number format to General or Number.

You see ##### — The column is too narrow. Widen it, or check whether the cell is still date-formatted and producing a long value.

You see #NUM! from DATEDIF — The start date is later than the end date, or the unit argument is misspelled. Keep units lowercase.

The count is off by one — You are mixing inclusive and exclusive counting. Add or remove the +1 and apply the same rule everywhere.

Results change unexpectedly — A formula uses TODAY or NOW, or a relative reference shifted when copied. Switch to absolute references where needed.

Frequently Asked Questions

Does the formula include the start and end date?

No. Plain subtraction counts the days elapsed between them, so both endpoints are excluded from the count. Add 1 if you want an inclusive total.

How do I count only business days?

Use =NETWORKDAYS(start,end). Add a holiday range as a third argument to skip specific dates. For weekends other than Saturday and Sunday, use NETWORKDAYS.INTL.

Why does my result show a date like 1/15/1900?

Excel stores dates as serial numbers starting from 1 January 1900, so a small number looks like an early date when date formatting is applied. Switch the cell to General or Number.

Can I count days between dates in different sheets?

Yes. Reference the other sheet by name, for example =Sheet2!B2-Sheet1!A2. Quote the sheet name if it contains spaces.

How do I count days from today to a deadline?

Use =B2-TODAY(). The value updates whenever the sheet recalculates, so it always reflects the current date.

Is there a way to get whole months instead of days?

Yes. =DATEDIF(A2,B2,"m") returns complete months, and "y" returns complete years. Rounding by dividing days by 30.44 gives only an approximation.