How to Calculate the Difference Between Dates in Google Sheets
To calculate the difference between dates in Google Sheets, you can use the DATEDIF function, which calculates the difference between two dates and returns the result in days, months, or years. Here's how to use the DATEDIF function in Google Sheets:
- Open your Google Sheet, and click on an empty cell where you want to display the difference between dates.
- Enter the DATEDIF function using the following syntax:
=DATEDIF(start_date, end_date, "unit")
start_date
is the cell containing the earlier date.end_date
is the cell containing the later date.unit
is the time unit you want to use for the result. It can be "D" for days, "M" for months, or "Y" for years.
- Close the parenthesis and press Enter. The result will be displayed in the selected cell.
Example
Let's say you have these two dates in your Google Sheet, and you want to calculate the difference in days, months, and years:
- Start date (A1): 01/01/2020
- End date (A2): 12/31/2020
To calculate the difference in days, you can use the following formula in an empty cell:
=DATEDIF(A1, A2, "D")
To calculate the difference in months, you can use the following formula in another empty cell:
=DATEDIF(A1, A2, "M")
To calculate the difference in years, you can use the following formula in another empty cell:
=DATEDIF(A1, A2, "Y")
The results will be displayed in the respective cells:
- Difference in days: 365
- Difference in months: 12
- Difference in years: 1
Did you find this useful?