To get the number of days, weeks or years between two dates in Excel, use the DATEDIF function. The DATEDIF function has three parameters that make it easy to use.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
How to use DateDif in Excel
1. Enter “d” for the third parameter to get the number of days between two different times.
Note: =A2-A1 gives the same result.
2. Enter “m” for the third argument to get the number of months between two different dates.
3. Enter “y” for the third parameter to get the number of years between two different dates.
4. Enter “yd” for the third parameter to skip the year and get the number of days between the two dates.
5. Enter “md” for the third parameter to skip the month and get the number of days between the two dates.
6. Enter “ym” for the third parameter to skip the year and get the number of months between the two dates.
Important note: the DATEDIF function returns the full number of days, months, or years. This may give unexpected results when the number of days/months of the second day is lower than the number of days/months of the first day. See the example below.
The result we get is 6 years. We need to use the following formula to return 7 years.
In addition, you can also view many other excel articles here.