0% found this document useful (0 votes)
14 views3 pages

Time Within Two Dates

The document discusses various methods to calculate the time interval between two dates, including simple subtraction, year difference, YEARFRAC function, and DATEDIF function. Each method offers different outputs based on the precision and format required, such as complete years, months, or days. The document concludes by encouraging readers to share their thoughts and improve their Excel skills.

Uploaded by

ayesah.macabayao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Time Within Two Dates

The document discusses various methods to calculate the time interval between two dates, including simple subtraction, year difference, YEARFRAC function, and DATEDIF function. Each method offers different outputs based on the precision and format required, such as complete years, months, or days. The document concludes by encouraging readers to share their thoughts and improve their Excel skills.

Uploaded by

ayesah.macabayao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Time within Two Dates

The amount of time between two given times is known as time interval. In other words, it is the
amount of time that has passed between the beginning and end of the event.

An interval between two events or dates is the period of time between them. There was a long
interval of silence.

Different approaches to compute differences between two dates

Method 1: Subtract the two dates


The obvious method I have seen with various trainees is to subtract the date of joining from the
specified end date and then divide the resultant value by 365 (or 360 for other regions) as shown
below.

The equivalent of the formula shown in cell E5 above would be = DAYS ($C$2, D6)/365 which would give
similar results.

Method 2: Subtract the years


In this approach, we assume we just need to compute the difference between the two dates as whole years,
as is the case when you want to compute your age as at the last birthday.

We therefore employ the formula shown in the figure below.

This approach rounds the result to the nearest whole number.

Method 3: Using the YEARFRAC function


This method gives similar results with the first method above. That is, it will compute the fractional year
differences between two dates.
For instance, if the last day is “31/07/2017” and you joined the company on “27/09/1998” then the formula will
compute the difference taking into account differential months. So, whereas method 2 would give 19 as the
difference in years, YEARFRAC will yield 18.84.

Take a look.

Notice that in this case you start by specifying the date of joining in the formula.

Let us compare the results


The figure that follows compares the output of the various approaches discussed so far.

Method 4: Using DATEDIF function


When you type DATEDIF as you would do with any other formulas, this formula doesn’t show a prompt
(normally called the intellisense) as other formulas do. It was popular in earlier Excel versions 2003 and
earlier) but has since not been given a lot of focus. I guess Microsoft might stop supporting it very soon (my
guess).

This function computes the difference in either the completed/full years, months or days, between two dates.
Just like the YEARFRAC function, it also requires you to specify the starting and the ending date. However,
you would need to specify the time unit of output, in terms of years, months or days.

Syntax: DATEDIF (Start_date, End_date, Unit)

There are six different outputs that you can get based on the time unit you specify as follows:[/vc_column_text]
[gem_table]

Uni
Output
t
“y” Difference in terms of complete years
“m” Difference in terms of complete months
“d” Difference in terms of complete days
Uni
Output
t

Returns the difference of complete days, ignoring the ones in the years that have been completed. Simply
“yd” put, for the specified start date, it takes the equivalent date in the immediate previous year as the basis of
subtracting the completed days

Returns the difference of complete months, ignoring the ones in the years that have been completed. It
“ym”
takes the immediate previous year as the basis of subtracting the full months

This interval just subtracts the day part of the two dates. For instance, in the table below, notice the “md”
“md”
column is the difference between the day element of the two dates. In row 9 for example it is 31-1=30
The figure below illustrates all the six possible outputs.

In conclusion
The various approaches discussed above are enough arsenals for various scenarios you may encounter.
Should you have comments or questions regarding manipulating dates in Excel, please lodge them in the
comments area below.

Please share the article with your colleagues and let them improve how they work with Excel.

You might also like