Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,050 --> 00:00:11,230
In this section of the course, we're going to dive into the magical world of using logical functions
2
00:00:11,230 --> 00:00:18,370
in Excel because logical functions are some of the most important functions that you can know or have
3
00:00:18,370 --> 00:00:23,080
in your toolkit when you're working in Excel, particularly if you're an intermediate user.
4
00:00:23,320 --> 00:00:28,750
And what logical functions help us do is basically make decisions.
5
00:00:28,900 --> 00:00:31,430
Now there are quite a few different logical functions.
6
00:00:31,450 --> 00:00:38,290
You'll find them on the Formulas tab in the logical group of the function library, and you can see
7
00:00:38,290 --> 00:00:40,220
all of them sitting in there.
8
00:00:40,780 --> 00:00:45,310
And we're going to use quite a few of these throughout the balance of this section.
9
00:00:46,150 --> 00:00:52,030
But what I wanted to make sure that we do in this first lesson is just do a quick recap on some of those
10
00:00:52,030 --> 00:00:54,940
basics just to make sure that were all on the same page.
11
00:00:54,940 --> 00:01:00,760
And we're starting from the same baseline because it's really important to understand the concept behind
12
00:01:00,760 --> 00:01:06,880
how logical functions work before we can move on to more complex calculations using things like ifs,
13
00:01:07,120 --> 00:01:10,750
some ifs count ifs and nested if statements.
14
00:01:11,050 --> 00:01:16,240
So let's talk about logical statements in their most basic form, first of all.
15
00:01:16,390 --> 00:01:20,740
And we're going to do this using an example, because it's always the best way to visualize this.
16
00:01:20,980 --> 00:01:26,530
So on this first worksheet, I have a very small table and this lists out some expenses.
17
00:01:26,770 --> 00:01:29,500
So we have the person's name in here.
18
00:01:29,590 --> 00:01:32,170
We have the total of their expenses.
19
00:01:32,660 --> 00:01:35,950
And what I want to do is work out if an approval is required.
20
00:01:36,790 --> 00:01:42,910
Now we have some additional information next to this that says expenses over the following amount must
21
00:01:42,910 --> 00:01:43,750
be approved.
22
00:01:43,900 --> 00:01:50,380
So if the expense is over a thousand dollars, then it needs to be approved by a manager.
23
00:01:50,530 --> 00:01:55,270
So I can work this out by using a very simple, logical statement.
24
00:01:55,480 --> 00:01:57,760
Now what exactly are logical statements?
25
00:01:57,880 --> 00:02:01,150
Well, it's basically like performing a test.
26
00:02:01,300 --> 00:02:07,420
So in this particular example, if we take the first expense just here, I would want to construct a
27
00:02:07,420 --> 00:02:18,340
logical statement that says if this value in Selby five is greater than or equal to this value in Cell
28
00:02:18,340 --> 00:02:21,220
G five, then it needs to be approved.
29
00:02:21,250 --> 00:02:26,620
And I want to perform that same test on all of these expense invoices.
30
00:02:26,860 --> 00:02:33,950
Now, when we're doing things like this, we use what we call operators and you can see I've just paste
31
00:02:34,000 --> 00:02:39,790
it in a little picture of a table that shows different operators that you might be using in your logical
32
00:02:39,790 --> 00:02:40,420
statements.
33
00:02:41,050 --> 00:02:48,460
So things like equal to greater than less than greater than or equal to so on and so forth.
34
00:02:49,360 --> 00:02:51,640
So let's do this first one just here.
35
00:02:52,300 --> 00:02:54,300
We're going to type in equals tool in Excel.
36
00:02:54,310 --> 00:02:58,350
No, we're about to do a formula and this is very straightforward.
37
00:02:58,370 --> 00:02:59,770
We perform our test.
38
00:02:59,980 --> 00:03:06,520
So is the value in Cell B five greater than or equal to?
39
00:03:06,550 --> 00:03:11,350
We're going to say that because if it's a thousand dead on, it needs to be approved.
40
00:03:12,160 --> 00:03:16,120
Is it greater than or equal to the value in Cell G five?
41
00:03:16,960 --> 00:03:22,680
Now remember, if you want to copy this formula down, we don't want that figure in Cell G five moving,
42
00:03:22,690 --> 00:03:27,880
so we need to lock it by pressing the four key and making it absolute look.
43
00:03:28,090 --> 00:03:31,880
If I hit enter just here is giving me a result of false.
44
00:03:32,560 --> 00:03:39,400
And what I can do is I can now copy that formula down and I can see here that all of the results showing
45
00:03:39,400 --> 00:03:45,340
as true on the invoices that are greater than or equal to a thousand and need to be approved.
46
00:03:45,520 --> 00:03:49,150
Now notice here that all of my answers are either true or false.
47
00:03:49,360 --> 00:03:55,900
And if you perform a logical calculation in this particular way, using these operators, the output
48
00:03:55,900 --> 00:03:58,870
is always going to be true or false.
49
00:03:59,080 --> 00:04:04,960
Now that might be absolutely five or whatever it is that you're doing, but sometimes it might be that
50
00:04:04,960 --> 00:04:06,520
you want to make this more meaningful.
51
00:04:06,550 --> 00:04:11,650
So instead of it saying false, just here, I might want it to say OK.
52
00:04:12,250 --> 00:04:16,840
Instead of saying true, just here, I might want it to say approval.
53
00:04:17,050 --> 00:04:22,600
So effectively, what I might want to do is attribute meaning to the true and false values.
54
00:04:22,810 --> 00:04:27,790
And I'm going to show you how you can kind of move on from this and do that in the next lesson.
55
00:04:28,060 --> 00:04:32,290
But for now, let's just get this concept of logical formulas straight in our head.
56
00:04:32,620 --> 00:04:36,460
We perform a test now because of the way that I've set this up.
57
00:04:36,730 --> 00:04:42,700
If this threshold in Cell G five was now to change, so maybe this now changes to twelve hundred.
58
00:04:43,060 --> 00:04:51,370
Notice that all of my results update if I was to change this to 500 and enter, everything is now true.
59
00:04:51,870 --> 00:04:58,210
Okay, so a really nice, effective way of putting this formula in and making it dynamic and easy to
60
00:04:58,210 --> 00:05:04,330
update now just to go back to changing these values and adding meaning to them in order.
61
00:05:04,440 --> 00:05:10,800
To do that, instead of just having a basic, logical function, we would need to turn this into an
62
00:05:10,800 --> 00:05:11,670
if statement.
63
00:05:12,270 --> 00:05:14,880
And that's basically what an if statement allows us to do.
64
00:05:14,910 --> 00:05:21,900
It's basically this same logical formula, but it allows us to attribute more meaning to the results
65
00:05:22,170 --> 00:05:25,980
and we're going to cover if and a lot more detail in the next lesson.
66
00:05:26,250 --> 00:05:29,340
But let me just show you how we would change these values.
67
00:05:29,850 --> 00:05:31,710
Now I'm just going to delete these out.
68
00:05:32,010 --> 00:05:38,460
Now what we're going to do is we're going to wrap basically our logical statement inside an if statement.
69
00:05:39,240 --> 00:05:44,850
Now notice here it says check whether a condition is met and returns one value, if true and another
70
00:05:44,850 --> 00:05:45,990
value, if false.
71
00:05:46,950 --> 00:05:50,820
So the first argument here is our logical test.
72
00:05:51,360 --> 00:05:53,850
So our logical test is pretty much what we just did.
73
00:05:54,660 --> 00:06:03,870
Is this value greater than or equal to this value at full to lock press comma to move on to the next
74
00:06:03,870 --> 00:06:04,410
argument?
75
00:06:04,980 --> 00:06:08,970
This is where we can attribute meaning to the true or false results.
76
00:06:09,660 --> 00:06:15,600
So it says value, if true, I can now define what I want it to say if the result is true.
77
00:06:15,780 --> 00:06:21,660
So if the result is true, effectively the number is greater than a thousand and it has to be approved.
78
00:06:22,380 --> 00:06:29,550
So in quote marks because text in formulas must always be in quote marks, I wanted to say approval.
79
00:06:30,600 --> 00:06:31,010
Comma.
80
00:06:31,980 --> 00:06:38,280
If the value in the cell is false, I don't want it to do anything, I just wanted to say, OK, let's
81
00:06:38,280 --> 00:06:39,120
close the bracket.
82
00:06:39,900 --> 00:06:43,680
So I've attributed meaning to the true and false results.
83
00:06:44,400 --> 00:06:45,300
Let's say enter.
84
00:06:45,900 --> 00:06:48,690
And I can now double click to copy that down.
85
00:06:48,960 --> 00:06:53,730
And it's a lot clearer for me to see which invoices need to be approved.
86
00:06:53,940 --> 00:06:58,330
So simply by adding in that if statement, we've changed the rather generic.
87
00:06:58,350 --> 00:07:03,780
True or false output to something that's more meaningful and easier to understand.
88
00:07:04,230 --> 00:07:06,810
And that's basically what an IFF does for us.
89
00:07:06,990 --> 00:07:12,840
Let's look at a few more examples of if in action now in this first table, again, very small table,
90
00:07:12,840 --> 00:07:18,690
we have some test scores, so we've got some student names and we've got the score they achieved in
91
00:07:18,690 --> 00:07:22,020
a test and the pass mark is 85.
92
00:07:22,290 --> 00:07:29,670
So I want to create an if statement that says if the value in this cell is greater than or equal to
93
00:07:29,670 --> 00:07:34,100
the value in this cell 85, I want a result of pass.
94
00:07:34,260 --> 00:07:36,540
If it's not, I want a result of fail.
95
00:07:36,690 --> 00:07:44,250
So again, we're going to use if our logical test is if the value in before is greater than or equal
96
00:07:44,280 --> 00:07:47,850
to the value in H3, we're going to copy this down.
97
00:07:47,850 --> 00:07:49,110
So f to lock.
98
00:07:49,860 --> 00:07:52,740
If that is true, then they have passed.
99
00:07:52,920 --> 00:07:53,510
Hooray.
100
00:07:54,000 --> 00:07:59,090
If it's false, then unfortunately they have failed to close the bracket.
101
00:07:59,100 --> 00:08:02,160
I'm going to do a control enter to stay in the same cell.
102
00:08:02,280 --> 00:08:08,580
Copy that down and I get my results so much more meaningful than simply true or false.
103
00:08:08,820 --> 00:08:14,940
Let's take a look at another example of if I'm going to add in a little bit more complexity just here.
104
00:08:15,150 --> 00:08:22,350
So in this second table, we have some products, we have the weight in kilos and then we have the price
105
00:08:22,350 --> 00:08:23,220
for those products.
106
00:08:23,220 --> 00:08:27,510
And I'm actually just going to change these to dollars just to keep everything in this spreadsheet consistent.
107
00:08:27,720 --> 00:08:34,380
Now what we're going to say here is that if the weight of the product is greater than or equal to 30
108
00:08:34,380 --> 00:08:41,520
kilos, then there's going to be a 20 percent shipping fee and that shipping fee is going to be 20 percent
109
00:08:41,520 --> 00:08:42,810
of the price.
110
00:08:43,110 --> 00:08:46,530
So let's constructeur if what is our logical test?
111
00:08:46,620 --> 00:08:57,600
Well, if the weight is greater than or equal to 30 kilos again, F4 to look now, what do we want it
112
00:08:57,600 --> 00:08:58,980
to do if that is true?
113
00:08:59,010 --> 00:09:05,250
So if the product is greater than or equal to 30 kilos, well, there's going to be a 20 percent shipping
114
00:09:05,250 --> 00:09:05,610
fee.
115
00:09:05,790 --> 00:09:11,010
So our true result is going to be a calculation because we want it to work out that shipping fee.
116
00:09:11,190 --> 00:09:14,190
So if it's true, we want to do the price.
117
00:09:15,340 --> 00:09:18,340
Multiplied by 20 percent.
118
00:09:20,180 --> 00:09:23,510
Four to lock coma if it's false.
119
00:09:23,870 --> 00:09:27,350
There's going to be no shipping fee, so we're going to put a zero on the end there.
120
00:09:28,970 --> 00:09:32,660
Close our bracket control answer to stay in the same cell.
121
00:09:32,990 --> 00:09:39,260
And if I copy this down, I should find that the only two products that have a shipping fee are the
122
00:09:39,260 --> 00:09:42,980
ones that are greater than or equal to 30 kilos.
123
00:09:43,280 --> 00:09:52,340
And this amount should be 20 percent of the actual price, so we can incorporate formulas into our logical
124
00:09:52,340 --> 00:09:53,660
if statements as well.
125
00:09:53,840 --> 00:09:59,540
Now we just want to finish off this lesson by running through a couple of other basic logical statements.
126
00:09:59,870 --> 00:10:08,480
And that is and and all now well and allows you to do is basically perform two logical tests.
127
00:10:08,720 --> 00:10:11,330
So we're taking this example of test results again.
128
00:10:11,330 --> 00:10:17,780
So we have our students and we have the score they achieved in Test one and the score they achieved
129
00:10:17,780 --> 00:10:18,560
in Test two.
130
00:10:18,770 --> 00:10:27,440
And what we're going to say is that they need to have achieved above 75 in Test one and above 65 in
131
00:10:27,440 --> 00:10:30,470
Test two in order to get a result of pass.
132
00:10:30,620 --> 00:10:34,010
So we're effectively performing two logical tests here.
133
00:10:34,730 --> 00:10:40,370
So if we want to do more than one and we need both of these to be true to get a positive result, we
134
00:10:40,370 --> 00:10:42,290
use the and formula.
135
00:10:42,500 --> 00:10:43,550
Notice the arguments.
136
00:10:43,550 --> 00:10:45,230
Logical one, logical two.
137
00:10:46,010 --> 00:10:55,490
So our first logical test is if this score is greater than or equal to the pass mark for Test one f
138
00:10:55,550 --> 00:10:56,600
for too long.
139
00:10:58,490 --> 00:11:07,730
And the second test score is also greater than or equal to the pass mark for tests to f for to lock.
140
00:11:08,420 --> 00:11:10,730
Both of those have to be true.
141
00:11:10,760 --> 00:11:14,090
In order to pass now, I'm going to enter.
142
00:11:14,120 --> 00:11:17,240
It's going to give me a result of true or false.
143
00:11:18,020 --> 00:11:24,170
If I want to add meaning to this and have pass or fail, I would need to edit this formula and wrap
144
00:11:24,170 --> 00:11:26,020
it in an if statement.
145
00:11:26,030 --> 00:11:28,610
Remember, that is how we add meaning.
146
00:11:28,820 --> 00:11:31,870
The first argument for our if statement is the logical test.
147
00:11:31,880 --> 00:11:38,300
Well, those are being generated by and formula so I can go straight to the end and just define what
148
00:11:38,300 --> 00:11:39,230
I wanted to say.
149
00:11:39,800 --> 00:11:42,890
So if both of those are true, it's going to be a pass.
150
00:11:43,970 --> 00:11:48,290
If both or one of those are false, it's going to be a fail.
151
00:11:48,950 --> 00:11:50,510
Close the bracket and sir.
152
00:11:50,870 --> 00:11:57,470
And now I've combined two functions together to perform two logical tests, and I've given them meaning
153
00:11:57,470 --> 00:12:00,530
using if all works in a very similar way.
154
00:12:00,530 --> 00:12:07,280
Except what we're saying here is that they need to have achieved the pass mark in Test one or in Test
155
00:12:07,280 --> 00:12:10,190
two in order to achieve a result of pass.
156
00:12:11,060 --> 00:12:15,550
So we're going to go straight in and type in a formula, a logical test.
157
00:12:15,560 --> 00:12:21,230
Well, we want to generate this using our or calculation logical one.
158
00:12:21,230 --> 00:12:22,130
Logical two.
159
00:12:23,090 --> 00:12:28,400
So if score one is greater than or equal to the pass mark.
160
00:12:29,840 --> 00:12:37,760
Four, to lock or score, two is greater than or equal to the pass mark for test to.
161
00:12:39,210 --> 00:12:41,920
Afford to look close off at all.
162
00:12:41,940 --> 00:12:47,220
We're now back into our if statement, we can now set up the value if those are true.
163
00:12:47,970 --> 00:12:49,980
So if that's true, we have a pass.
164
00:12:50,550 --> 00:12:57,990
If it's false, we have a fail control enter and then I can copy that down.
165
00:12:58,620 --> 00:13:05,190
So notice here that the only one that comes up as fail is where both of these schools are less than
166
00:13:05,190 --> 00:13:06,030
the pass marks.
167
00:13:06,270 --> 00:13:08,880
So we've looked at basic, logical functions there.
168
00:13:08,880 --> 00:13:14,970
We've seen and we've seen or and we've seen how we can add meaning by using, if and in the next lesson,
169
00:13:14,970 --> 00:13:17,760
we're going to look at if statements in a lot more detail.
17670
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.