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.

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

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

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

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.

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

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.

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

Step 1:

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

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

Step 2:

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

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

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.

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

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.

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

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.

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

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

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

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!

Update 28 July 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile