# To calculate the number of days, years, andmonths between two dates in Microsoft Excel 2019

1. Click on a cell in the worksheet that must return the number of daysbetween two dates, and select cell B14.
2. Enter the following formula into the cell: =day(cell thatcontains the first date)-day(cell that contains the seconddate). In this example, the formula willbe =day(C8)-day(B8)
3. Press Enter on the keyboard. If cell B8 was used as thefirst date in the calculation, the formula result would have beennegative (that is, -11 in the first instance). To fix this,edit the formula to add the absolute function at the start of theformula, asfollows: =ABS(day(E8)-day(D8))
4. You can also just minus the cells from each other to get the sameresult, but if any other criteria are required—such as month oryear—then you would need to use the appropriate function instead.

To work out the February workingdays, proceed as follows:

1. Enter the formula =ABS(day(E8)-day(D8)) into cellC14.
2. Press Enter on the keyboard. The result can be seen in thefollowing screenshot:
1. The February column is displayingthe full date and not the day. This has happened in this example as thecell format set to date format prior to entering the formula. To correctthis, simply change the cell format to General.