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.
- How to separate the date, month, and year columns into 3 different columns in Excel
- Instructions on how to insert the current date in Excel
- How to calculate the number of days in Excel
- 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:
- end_date: the end date to determine the number of days, is a required parameter.
- start_date: the first day you want to specify the number of days, is a required parameter.
Note when using DAYS function:
- If end_date and start_date are all numeric, the function uses EndDate - StartDate to calculate the number of days between these two dates.
- 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.
- If end_date and start_date are outside the scope of valid dates, the function returns the #NUM! Error value.
- 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.
In the first cell enter the result of the distance calculation, we enter the formula = DAYS (B12, A12) and press Enter.
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.
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.
Step 1:
In the first year of work, enter the formula = DAYS (E2, D2) / 365 and press Enter.
Step 2:
When displaying the first result, scroll down to the remaining cells.
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.
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.
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.
Results show and calculate the number of years of service until the current year. Scroll down to the other cell to show the result.
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!
You should read it
- How to use the SUM function to calculate totals in Excel
- How to calculate the number of days in Excel
- Basic Excel functions that anyone must know
- MS Excel 2007 - Lesson 6: Calculation in Excel
- How to use the kernel function (PRODUCT function) in Excel
- How to use SUMPRODUCT function in Excel
- DAYS360 function - The function returns the number of days between 2 dates, based on 360 days in Excel
- How to use the MOD function and QUOTIENT function in Excel
- SUM function in Excel: How to use SUM to calculate totals in Excel - SUM function in Excel
- How to add computers to Excel
- How to use DSUM function in Excel
- How to use the Power function in Excel
Maybe you are interested
List of devices to be updated Android 4.4 KitKat 8 features on Android 4.4 KitKat you may not know yet Instructions for setting shortcuts on TalkTV How to register for Facebook Flex Mobifone service for free data 4 most powerful scary sniper rifles in the world The giant robot war between the US and Japan will take place on October 18