DAYS function, how to use the function to calculate the number of days between two time points in Excel

The DAYS function in Excel returns the results between two different timelines.

Excel functions are many and divided into categories based on their functions such as database functions, information functions, technical functions, etc. In which there will be 10 functions that we often use in Excel. such as the SUM function in Excel, the IF function or the DAYS function.

DAYS function belongs to the date function group, used to return results between 2 time points. With DAYS function, the calculation of the time interval will be much easier, can be applied to many different cases. The following article will show you how to use DAYS function in Excel.

  1. How to separate the date, month, and year columns into 3 different columns in Excel
  2. Instructions on how to insert the current date in Excel
  3. How to calculate the number of days in Excel
  4. Calculation of age in Excel

Instructions for using DAYS function in Excel

DAYS function in Excel has a syntax to use = DAYS (end_date, start_date) .

Inside:

  1. end_date: the end date to determine the number of days, is a required parameter.
  2. start_date: the first day you want to specify the number of days, is a required parameter.

Note when using DAYS function:

  1. If end_date and start_date are all numeric, the function uses EndDate - StartDate to calculate the number of days between these two dates.
  2. If one of the two end_date and start_date values ​​is textual, the function automatically switches to the date format using the DATEVALUE (date_text) function and then calculates.
  3. If end_date and start_date are outside the scope of valid dates, the function returns the #NUM! Error value.
  4. If the text argument cannot be converted to a valid date format, the function returns the #VALUE! Error value.

Example 1: Calculate the time gap

We have the following time table with different timelines and formats.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 1DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 1

In the first cell enter the result of the distance calculation, we enter the formula = DAYS (B12, A12) and press Enter.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 2DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 2

As a result, we have a time gap between two different timelines. You drag the first result box down the remaining cells of the table.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 3DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 3

Example 2: Calculate the number of years the employee works

To calculate the number of working years for employees, users must use DAYS function to calculate the working time and then divide it by 365 to get the number of years of work.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 4DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 4

Step 1:

In the first year of work, enter the formula = DAYS (E2, D2) / 365 and press Enter.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 5DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 5

Step 2:

When displaying the first result, scroll down to the remaining cells.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 6DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 6

Note if the result does not show the number of years, right-click and choose Format Cells. Then we select the Number format. If the result displays a decimal, remove the product in Use 1000 Separator and enter the number 0 in the Decimal palces to show the integer value for the number of years.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 7DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 7

In the case of a retired person, we must enter another formula to calculate the number of years of service until the current time of entering data.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 8DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 8

In the input box, enter the formula = DAYS (TODAY (), D8) / 365 and press Enter. In which cell D8 will be the time to start calculating seniority until the current year.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 9DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 9

Results show and calculate the number of years of service until the current year. Scroll down to the other cell to show the result.

DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 10DAYS function, how to use the function to calculate the number of days between two time points in Excel Picture 10

Above are some examples of DAYS functions in Excel. Usually the DAYS function will be combined with other functions such as TODAY, for example, to calculate a certain time period.

I wish you all success!

3.5 ★ | 2 Vote