Subtract the earlier date from the later date. If A2 holds March 1, 2026, and B2 holds March 31, 2026, then =B2-A2 returns 30. The result is a count of days, not a date.
Fix the format if the answer shows as a date
Excel often applies a date format to a formula that subtracts dates, so 30 may display as 1/30/1900. The number is correct; only the display is wrong. Select the cell, press Ctrl+1, and choose Number or General.
DAYS and DATEDIF
=DAYS(B2,A2) does the same job and lists the end date first, which makes the order easy to remember. DAYS is available in Excel 2013 and later.
=DATEDIF(A2,B2,“D”) also returns the number of days. Unlike plain subtraction, it returns #NUM! when the start date is after the end date, which can serve as a warning.
Include the first or last day
Subtraction measures the gap, so the start day isn’t counted. For a five-day trip from March 1 to March 5, the gap is 4. To count both ends, add 1: =B2-A2+1 returns 5.
Reversed dates and negative results
If the end date comes before the start date, the subtraction returns a negative number. To get the size of the gap either way, wrap it in ABS: =ABS(B2-A2).
Days until or since today
=A2-TODAY() returns the number of days until the date in A2. If that date is in the past, the result is negative. The number changes each day, because TODAY() recalculates.
Dates that include times
If a cell holds a date and a time, the subtraction includes the fraction of a day. To count whole days only, remove the times with INT:
=INT(B2)-INT(A2)
INT drops the decimal part, which leaves only the date.
Business days only
Plain subtraction counts weekends and holidays. For working days, use NETWORKDAYS. The steps are in networkdays excel exclude weekends and holidays.
When the answer is #VALUE!
#VALUE! usually means one of the dates is text that Excel can’t read as a date. The usual fixes are in how to fix #value error in excel, and the causes of text dates are covered in excel not recognizing dates as dates.
Copied formulas
If the result changes in unexpected ways as you copy the formula down, check how the references move. The usual causes are in why does copied formula give wrong result in excel.