Calculating Days Between Two Dates in Excel (With Examples)
Excel is a versatile tool with many functions, including date and time arithmetic. Calculating the number of days between two dates is a common task. Whether you're tracking project timelines, scheduling events, or doing financial forecasting, here are seven examples of how you can calculate days between two dates in Excel.
Example 1: Basic Calculation
Excel stores dates as sequential serial numbers, making it easy to calculate the number of days between two dates. Simply subtract the earlier date from the later date. If A1 has the start date and B1 the end date, your formula would be =B1-A1
.
Example 2: DATEDIF Function
Excel's DATEDIF function can also calculate the number of days between two dates. The syntax is =DATEDIF(start_date, end_date, "D")
. This will return the number of days between the start and end date.
Example 3: NETWORKDAYS Function
To calculate the number of workdays between two dates (excluding weekends), you can use the NETWORKDAYS function. The syntax is =NETWORKDAYS(start_date, end_date)
.
Example 4: NETWORKDAYS.INTL Function
If your workweek doesn't follow the typical Monday-Friday schedule, the NETWORKDAYS.INTL function can be customized to exclude specific days of the week. For example, =NETWORKDAYS.INTL(start_date, end_date, 7)
will calculate the number of days excluding Sundays (represented by the number 7).
Example 5: Using TODAY Function
If you need to calculate the number of days from a specific date until today, use the TODAY function in combination with a subtraction operation. For example, =TODAY()-A1
will give the number of days between the date in A1 and today.
Example 6: Using YEARFRAC Function
If you need to get the fraction of a year between two dates, you can use the YEARFRAC function. The syntax is =YEARFRAC(start_date, end_date)
. This function can be particularly useful for financial calculations.
Example 7: Calculating Age
If you need to calculate someone's age, you can do so with a combination of the TODAY and INT functions. Use =INT((TODAY()-birthdate)/365.25)
where 'birthdate' is the cell containing the person's birth date.