If you're watching this video, you're most likely looking for how to calculate
the age if you have two dates that you use in a spreadsheet. There's lots of different
ways to do it if you look around on the internet but most of them are just more
complicated than they need to be. There's a function available in Excel but it's
not one of the standard functions. It's only in there because Lotus 1-2-3 had it
25 years ago and they wanted it to be compatible. It's actually really
helpful for doing this the DATEDIF function works by taking several inputs. The first
is a start date, second is the end date, and then the third is a type of units
that you want. So, if I hit the Escape key, this is 17 years. This is using Y as the
last parameter. When I mentioned before that this wasn't a standard
function; if you notice, if you type in = a you type DATE and then start to
typing DIF, entire list from below disappears because this isn't listed as
standard. It's not going to give you help on it as you type so when you type DATEDIF,
and you do the opening parenthesis, you're on your own. It doesn't give you
any hints. You have to look at this documentation to see how it works. I have
a website, the link is in the upper right-hand corner right now, you can
click on that to see all these instructions written out for you.
We'll go down into the first example, and this is going to show you - one how it
works - but also what the different parameters are for the units. It's a
little bit confusing. This column is easiest. It's just counting the number of
years - number of total years though. If it's 17.75 it's
just gonna give you 17. If you want the years months in the days, you string
it together with these three functions. They're all DATEDIF, they're using the
same start and end date but one is Y, one is YM and one is an MD. The YM is saying
"I know you already calculated the year so how many months after the last year
that you calculated." The MD is saying "I know you already have the months, how
many days after that last month?" So that's why they this can work and it's
not saying a couple thousand days there. It knows you already had the
months and the days. For the last portion of this, I just strung them
together with the CONCATENATE function. This & is shorthand for CONCATENATE. I
didn't actually write it, but you can also spell out concatenate. What this
formula does though, it says give me what's in D14 and add what's in quotes
which is space years comma space and what's an E14 ,etc. Concatenating can
allow you to output data that looks like sentences. Let's go a little bit
further down and I'll show you how the M and the MD work. M alone
returns the number of months without subtracting the whole years first. So
from January 23rd, 1999 to August 28th, 2016 is
211 months but it's also five days so you notice this is the same. This MD is
the same function that was used in the first example. It doesn't matter if you
also did years. All this is doing is the number of days after the last month. The next
example is going to show you how YD works. If you first
calculate the number of years. YD is gonna say the number of days elapsed
after the last whole year. This I think would be a little bit more rare to use.
I don't know why you're gonna say seventeen months and 217 days but hmm, maybe you are.
The last one is just D by itself. All this does is the exact same thing as
subtracting the two dates. I did the same formulas here next to each other to show
you. So if you do DATEDIF, you do these two
fields, start date and end date, you get 6,427. If you
subtract the two, you get the same thing. If you're using DATEDIF, and you're only
using the D parameter, it's probably gonna simplify things to just do
subtraction. You don't need DATEDIF. That's pretty much all there is to this
function. I don't know why Excel wouldn't have this in their standard list of
functions anymore because it's pretty easy to use. I will tell you there is a
warning that the MD function doesn't always work. It can produce errors. Keep
that in mind if you're seeing strange behavior. Microsoft knows about it and
there is a workaround on their website. If you search for the DATEDIF function,
if you go on the website, that I referenced earlier, you can see that
Microsoft says the MD can cause errors. Follow this link and it'll tell you
about it. That's all for now really about the DATEDIF function. I hope
that was helpful. Leave a comment if you have any questions. Thanks.