Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,710 --> 00:00:13,000
The date dysfunction in Excel will help you work out the difference between two dates, and this is
2
00:00:13,000 --> 00:00:17,710
a little bit of a weird function, and I'll explain to you why in a moment.
3
00:00:18,430 --> 00:00:20,710
Before we get onto that, let's take a look at the data.
4
00:00:21,490 --> 00:00:24,010
So in this table, I have some employee numbers.
5
00:00:24,010 --> 00:00:28,660
I have the employee's first name, their last name and their date of birth.
6
00:00:29,410 --> 00:00:32,750
And what I want to do is I want to work out how old they are.
7
00:00:32,770 --> 00:00:34,270
So what is their age?
8
00:00:34,540 --> 00:00:39,340
Based off of their date of birth, but also using today's date?
9
00:00:40,060 --> 00:00:45,460
So at the top of the spreadsheet, I have today's date and I'm using the today function to get that
10
00:00:45,460 --> 00:00:45,880
date.
11
00:00:46,180 --> 00:00:52,540
Now, in this type of scenario, it's going to be more beneficial for me to use the function today as
12
00:00:52,540 --> 00:01:01,120
opposed to hard coding today's day in because I want this age to update as the current day changes.
13
00:01:01,450 --> 00:01:07,600
And it's this piece of information today's date and the date of birth that we need in order to construct
14
00:01:07,600 --> 00:01:08,320
this formula.
15
00:01:09,040 --> 00:01:13,450
Now, as I mentioned, this is a bit of a strange formula and you'll notice why straight away.
16
00:01:14,140 --> 00:01:22,900
So if we time equals and then we want to type in date diff notice that nothing comes up underneath.
17
00:01:23,350 --> 00:01:28,990
Normally, when I type in a function, Excel recognizes it in the functions library and it shows me
18
00:01:28,990 --> 00:01:29,430
underneath.
19
00:01:29,440 --> 00:01:34,960
For example, if I was typing in the look up, you can see underneath it, says V.
20
00:01:34,960 --> 00:01:35,470
Look up.
21
00:01:35,710 --> 00:01:38,080
Whereas when we do date def, it doesn't.
22
00:01:39,280 --> 00:01:43,420
It also means I can't press the tab key to put my first parentheses in.
23
00:01:43,690 --> 00:01:45,200
I need to add in the bracket.
24
00:01:46,030 --> 00:01:51,490
Now, as soon as I add that in, it does come up with date diff underneath, but it doesn't show me
25
00:01:51,490 --> 00:01:52,430
any arguments.
26
00:01:52,450 --> 00:02:00,340
So basically, this function doesn't exist in Excel's information library, although the function does
27
00:02:00,340 --> 00:02:02,470
exist, which is very, very strange.
28
00:02:02,680 --> 00:02:07,990
So effectively when we're constructing this, it's one of those cases where you either know or you don't
29
00:02:07,990 --> 00:02:13,060
because you're not going to get any help with regards to the arguments you need to provide this function.
30
00:02:13,930 --> 00:02:17,290
Now, fortunately, this is a very simple function.
31
00:02:17,560 --> 00:02:24,910
Our first argument is going to be the date of birth, which is d six comma.
32
00:02:25,660 --> 00:02:28,960
A second argument is going to be today's date.
33
00:02:29,620 --> 00:02:37,780
So B three, and now we need to tell the formula what format we want to display this result in.
34
00:02:38,560 --> 00:02:39,650
Now my result.
35
00:02:39,670 --> 00:02:42,820
I want the people's ages so effectively.
36
00:02:42,820 --> 00:02:44,770
I want this in year format.
37
00:02:45,400 --> 00:02:49,750
So in quote marks, if I type in one y and closed the quotes.
38
00:02:50,800 --> 00:02:52,180
That is my formula.
39
00:02:52,390 --> 00:02:54,550
Let's hit enter and see what we get.
40
00:02:55,330 --> 00:02:56,200
Looks pretty good.
41
00:02:56,290 --> 00:02:58,240
Now can I double click to copy this down?
42
00:02:59,050 --> 00:03:00,400
No, I cannot.
43
00:03:00,610 --> 00:03:01,850
Why can't I do that?
44
00:03:01,870 --> 00:03:02,800
Let's undo.
45
00:03:03,550 --> 00:03:05,860
What if I double click to take a look at this formula?
46
00:03:05,870 --> 00:03:12,790
You can see here that with Cell B three, which is where we have the today function, I haven't made
47
00:03:12,790 --> 00:03:13,780
this absolute.
48
00:03:14,290 --> 00:03:20,620
So when I copy this formula down, the cell reference for B three is also going to start moving down
49
00:03:20,860 --> 00:03:22,720
into these first names.
50
00:03:22,730 --> 00:03:24,400
So that is why we're getting an error.
51
00:03:25,000 --> 00:03:30,160
So all I really need to do here is make B three absolute by pressing the F4 key.
52
00:03:31,090 --> 00:03:33,010
Let's enter and try that again.
53
00:03:33,970 --> 00:03:35,620
Double click to copy down.
54
00:03:36,460 --> 00:03:37,200
And there we go.
55
00:03:37,210 --> 00:03:40,090
I now have everybody's ages in here.
56
00:03:40,930 --> 00:03:46,150
So just remember with that function, you don't get any help with regards to arguments.
57
00:03:46,600 --> 00:03:51,490
And the thing that I find quite difficult here, it's not too bad on this example, but sometimes when
58
00:03:51,490 --> 00:03:55,570
I'm trying to use day diff, I tend to get the cell references round the wrong way.
59
00:03:55,600 --> 00:04:00,610
I can never really remember if the date of birth is supposed to go first or if today's date is supposed
60
00:04:00,610 --> 00:04:01,360
to go first.
61
00:04:01,360 --> 00:04:06,550
But the only thing I can suggest to you there is just try out if it doesn't work.
62
00:04:06,670 --> 00:04:08,110
Switch them around the other way.
63
00:04:08,200 --> 00:04:13,060
Now another thing if I double click to edit this, if I wanted to show their age in months, I don't
64
00:04:13,060 --> 00:04:13,990
know why I'd want to do that.
65
00:04:13,990 --> 00:04:18,780
But if I did, I would just substitute the Y for an M and hence I.
66
00:04:18,810 --> 00:04:21,070
It's going to show me their age in months.
67
00:04:21,490 --> 00:04:25,300
So Mark Berry is effectively two hundred and six months old.
68
00:04:25,990 --> 00:04:31,540
If I wanted to show their age in days, I would substitute that with a D..
69
00:04:31,870 --> 00:04:32,820
And there we go.
70
00:04:32,830 --> 00:04:41,800
Mac is six thousand five hundred and eighty days old, so don't forget you can change the format from
71
00:04:41,800 --> 00:04:42,940
here as well.
72
00:04:43,480 --> 00:04:47,410
Now, for this type of calculation, there is another way you can do this or just finish off by showing
73
00:04:47,410 --> 00:04:49,720
you this as well, because you might find it a bit easier.
74
00:04:50,110 --> 00:04:53,200
Let's control, shift down, arrow and delete everything out.
75
00:04:53,830 --> 00:04:59,140
What I could do is sometimes you don't even need to use a formula if you want to work out the difference
76
00:04:59,140 --> 00:05:00,190
between two dates.
77
00:05:00,790 --> 00:05:06,190
So what I could do is today's date minus the date of birth.
78
00:05:06,910 --> 00:05:11,570
Now notice that's going to give me my result in days.
79
00:05:12,190 --> 00:05:16,240
So what else would I need to do to this formula to get this to display as years?
80
00:05:17,350 --> 00:05:27,820
Well, I could divide it by 365 now if I just do divided by 365 because of the way Excel works out calculations,
81
00:05:27,820 --> 00:05:29,440
that's not going to be quite correct.
82
00:05:30,160 --> 00:05:36,250
So what I need to do here is I need to enclose the first part of this formula in brackets.
83
00:05:36,970 --> 00:05:42,730
So Excel is going to do the B three minus D six, first of all, and then it's going to divide the result
84
00:05:42,730 --> 00:05:44,380
by 365.
85
00:05:45,090 --> 00:05:50,740
What I also need to do is lock the cell reference for today's date.
86
00:05:51,400 --> 00:05:52,330
Let's enter.
87
00:05:52,840 --> 00:05:55,630
We can double click to copy those down.
88
00:05:55,630 --> 00:05:59,530
And then all I need to do is just have a little play around with the formatting.
89
00:05:59,920 --> 00:06:05,020
So I'm going to switch these to a number and then take those decimal places down, which is going to
90
00:06:05,020 --> 00:06:06,970
give me the same result.
91
00:06:07,750 --> 00:06:13,660
So two different ways there that you can work out the difference between two dates.
8780
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.