Learn to subtract dates in Excel.
To subtract two dates in Excel and get the number of days between them, you can use the “DATEDIF” function. The syntax for this function is:
=DATEDIF(start_date, end_date, "unit")
start_date is the earlier date,
end_date is the later date, and
unit is a string representing the units you want the difference to be expressed in. The possible values for
- “d”: Days
- “m”: Months
- “y”: Years
- “ym”: Months ignoring days
- “yd”: Days ignoring months
For example, to find the number of days between January 1st, 2022 and February 1st, 2023, you can use the following formula:
=DATEDIF("2022-01-01", "2023-02-01", "d")
This will return the result
366, which is the number of days between January 1st, 2022 and February 1st, 2023 (including both dates).
Note: If you just subtract the two dates directly (e.g.
2023-02-01 - 2022-01-01), you’ll get the result as a date serial number, not the number of days between the dates. To change this, you must format the cell to “Date.”