Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,500 --> 00:00:11,440
In exercise, 11, I'd like you to practice creating custom data validation.
2
00:00:11,740 --> 00:00:17,950
So for this exercise, we want people to be able to type in a part number, but that part number must
3
00:00:17,950 --> 00:00:25,150
meet certain conditions and those conditions are that the part number has to be six characters long.
4
00:00:25,480 --> 00:00:30,370
And the first three characters are letters, and the last three characters are numbers.
5
00:00:31,000 --> 00:00:36,790
So if anybody tries to enter anything in that doesn't meet those rules, they're not going to be able
6
00:00:36,790 --> 00:00:38,620
to input it into the cell.
7
00:00:38,860 --> 00:00:44,470
Now a couple of things before you get going on this, I've already put the headings up here just kind
8
00:00:44,470 --> 00:00:46,630
of start you off in the right direction.
9
00:00:47,290 --> 00:00:53,410
If you recall, first, we needed to use a formula to work out the length of the plot number, and then
10
00:00:53,410 --> 00:00:56,290
we changed it to a true or false value.
11
00:00:56,530 --> 00:01:02,440
Because what we're aiming for here is for all three of these to be true when the part numbers been entered
12
00:01:02,440 --> 00:01:07,240
correctly and false when something's been entered incorrectly.
13
00:01:08,050 --> 00:01:13,390
So we need to find the length of the part number and then convert that to a true or false result.
14
00:01:14,110 --> 00:01:18,970
We need to extract the first three characters and make sure that those are letters.
15
00:01:19,270 --> 00:01:24,010
And then we need to extract the last three characters and make sure that those are numbers.
16
00:01:24,310 --> 00:01:29,980
Then we need to combine all of the formulas that we've created together before pasting it into our data
17
00:01:29,980 --> 00:01:30,790
validation.
18
00:01:31,000 --> 00:01:35,830
And remember, you can use the clipboard to help you when you're copying your long formulas.
19
00:01:36,100 --> 00:01:42,670
And if you want to, if you find that pretty easy as an optional extra, you can add an error message
20
00:01:42,670 --> 00:01:44,830
into your data validation rule.
21
00:01:45,100 --> 00:01:46,300
So give that a go.
22
00:01:46,330 --> 00:01:49,540
If you'd like to see my answer, then please keep watching.
23
00:01:49,900 --> 00:01:54,970
So the first thing I'm going to do here is we're going to grab the length of the part number.
24
00:01:55,570 --> 00:01:58,660
So for this, we're going to use the lens function.
25
00:01:59,410 --> 00:02:05,980
Let's select the part number and that is going to return the result of six because we have six characters
26
00:02:06,190 --> 00:02:12,640
now, I effectively need to turn this into a true or false result, so I need to make this a logical
27
00:02:12,640 --> 00:02:13,240
formula.
28
00:02:14,140 --> 00:02:21,070
So what I can say here is is the length of the Pont number equal to six.
29
00:02:22,540 --> 00:02:24,640
If it is, I'm going to get a true result.
30
00:02:24,820 --> 00:02:29,410
If I add another number onto the end, it's going to be a false result.
31
00:02:29,950 --> 00:02:32,350
So we're looking good so far just that.
32
00:02:32,950 --> 00:02:38,020
Now the next thing we need to do is we need to check that the first three characters that have been
33
00:02:38,020 --> 00:02:39,880
entered are letters.
34
00:02:40,600 --> 00:02:44,260
So let's extract those three characters from this string first.
35
00:02:44,770 --> 00:02:51,730
We're going to type in equals left, going to select the text and we want the first three characters.
36
00:02:53,050 --> 00:02:55,420
So that is given us a b c.
37
00:02:56,170 --> 00:03:00,430
Now we need to change this into a true or false result.
38
00:03:01,330 --> 00:03:06,250
So the first thing we're going to add into here is we're going to ask the question Is this a number?
39
00:03:07,810 --> 00:03:11,230
Let's add that on to the front and close of the bracket.
40
00:03:11,530 --> 00:03:19,390
Now, currently, this is saying false because Excel thinks that this number is text, so this is where
41
00:03:19,390 --> 00:03:23,380
we need to convert it into a value instead.
42
00:03:23,920 --> 00:03:31,390
So we're going to add value in here and of course, close off another bracket, and it's still saying
43
00:03:31,390 --> 00:03:32,280
that it's false.
44
00:03:32,290 --> 00:03:34,000
We kind of want to switch this around.
45
00:03:34,000 --> 00:03:37,150
So it's the opposite because this is effectively a number.
46
00:03:37,780 --> 00:03:43,450
So we're going to go up to the form in a bar and we're going to add in knots, which will basically
47
00:03:43,510 --> 00:03:44,710
do the reverse.
48
00:03:45,310 --> 00:03:52,360
So now we get true, we're going to do a similar thing to extract the last three characters and check
49
00:03:52,360 --> 00:03:53,950
to see if those are numbers.
50
00:03:54,790 --> 00:03:56,710
So we're going to say equals right.
51
00:03:57,520 --> 00:04:01,330
We're going to select the text and we want to extract the last three.
52
00:04:02,740 --> 00:04:04,880
Now we're going to do the same thing.
53
00:04:04,900 --> 00:04:06,040
We're going to go up.
54
00:04:06,280 --> 00:04:14,020
We're going to say is no, and we're going to convert it straight into a value as opposed to text.
55
00:04:14,650 --> 00:04:18,160
I now need to add two brackets on the end and hit enter.
56
00:04:19,030 --> 00:04:24,670
So now notice that all of these are true when the part number has been entered incorrectly.
57
00:04:25,300 --> 00:04:31,690
If I change anything in here, so if I change this two numbers this first part, this is going to change
58
00:04:31,690 --> 00:04:35,440
to false first three characters are letters that is now false.
59
00:04:36,130 --> 00:04:47,950
If I double click and let's say a b c d e f, this one is now going to change to false because the last
60
00:04:47,950 --> 00:04:50,930
three characters are not numbers.
61
00:04:51,760 --> 00:04:57,160
And if I add something extra onto the end, this one is going to go to false because it no longer is
62
00:04:57,160 --> 00:04:58,330
six characters long.
63
00:04:59,050 --> 00:05:02,080
So let's put this back to ABC one two three.
64
00:05:02,800 --> 00:05:04,150
All of those are true.
65
00:05:05,160 --> 00:05:09,510
So now we have all of our formulas, we need to combine them together.
66
00:05:09,720 --> 00:05:13,110
And for this, we're going to open up the clipboard.
67
00:05:14,160 --> 00:05:16,440
Let's clear out everything that we have there.
68
00:05:16,830 --> 00:05:23,640
I'm going to double click that, select the first formula without the equals control c to copy to the
69
00:05:23,640 --> 00:05:34,900
clipboard, double click Select Control C and then finally, double click that select everything control.
70
00:05:35,220 --> 00:05:41,340
See, now we're going to combine those together with an end function.
71
00:05:42,330 --> 00:05:49,350
So all we need to do here is paste, comma paste, comma paste.
72
00:05:50,160 --> 00:05:54,420
Add another close in bracket hit enter and our result is true.
73
00:05:55,350 --> 00:06:01,770
So now that we have this big, long formula working correctly, we can copy and paste this into our
74
00:06:01,780 --> 00:06:03,030
data validation.
75
00:06:03,870 --> 00:06:12,450
So let's select it Control C to copy, and we want to apply this data validation to sell a five up to
76
00:06:12,450 --> 00:06:15,720
data into data validation.
77
00:06:16,440 --> 00:06:23,160
And we want to do custom data validation and control V to paste in our formula.
78
00:06:23,940 --> 00:06:25,290
Click on OK.
79
00:06:26,370 --> 00:06:33,090
So now we can pretty much get rid of all of this that we have in here, and I'm just going to clear
80
00:06:34,110 --> 00:06:34,830
those cells.
81
00:06:35,640 --> 00:06:40,260
So now if I change this to ABCD F, I can see that that's not working.
82
00:06:40,560 --> 00:06:45,030
If I change it to one two three four five six, that's also not working.
83
00:06:45,930 --> 00:06:53,070
But if I change it to d e f one two three, that's going to work because it meets all of the rules.
8658
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.