IF Function in Excel Tutorial

Data Translates
219 followers
Hi everyone, my name is Kevin. Today I want to show you how you can use the if function in
Microsoft Excel. The if function is one of the most popular functions in Microsoft Excel. Before
we jump into this, as full disclosure, I work at Microsoft as a full-time employee. My HR department
requires me to say that anytime I talk about Microsoft products. First off, what is the if
function? So with the if function, what you can do is you can do logical comparisons. Basically,
if something is true, do this. If something is false, do that. All right, well it sounds easy
enough and it actually is, but let's take a look at an example. That's probably the easiest way to
show what you can do with the if function. All right, let's jump on the PC. Here I am on my PC
and I have a nice little table set up and we're just going to make up a fun little scenario here.
Let's pretend that I work in, let's say, the compliance department within a company and I have
the fun job of looking at people's expenses. So anytime someone goes on a trip or maybe they go
to a conference, they submit expenses and I need to make sure all those expenses are legitimate.
So let's say that an employee recently went on a trip and there are different categories of expenses.
You have airfare, food, and entertainment. It wouldn't be a business trip without some good
entertainment. And what we see here is column B, we have a budgeted amount. So as our company,
we want to make sure that our employees stay within a certain range of how much they spend
for these different activities. And then for this particular employee, we could see the actuals of
how much they spent. Okay, so what I want to do is, because I work in the compliance department
and I'm just looking at these things each and every single day, it's a little overwhelming
looking at all these expense reports and I want to make my life easier. And luckily,
the IF function can help me with that. So how do we get started with the IF function? Well,
the first thing that we're going to do is we're going to click on this little insert function icon
up here on the toolbar in Excel. This way we can insert a function. So let's go ahead and click on
that. And now what we want to do is we're going to simply type in IF. We're going to search for
the function and click on go. And what will happen is you'll see it pop up down here below where it
select a function. It'll be the first one that pops up. Now let's take a quick look at the
description here. So this shows you how to structure your IF function. So what you're
going to do is there's some type of test you're doing. And then if it's true, do this. If it's
false, do that. So that's the general structure. And I'm going to walk through how you actually do
this then. And so quick look at the description, checks whether a condition is met. In my case,
it's checking whether the actual spend is under the budget and returns one value of true and
another value of false. Okay. Well, sounds good. Why don't we jump into the example here?
Okay. So the first thing I want to do is, well, logical tests. It's basically checking
what is my criteria. So what I'm going to do is I want to say, well, let's see if the actual was
less than the budget amount. And so here in this case, you'll see that it says true 525 is less
than 600. And now what I get to do here is it says, well, if it's true, what do I do? Well,
because I want to make my life easier. So what I'm going to do is I'm going to insert a quote
because I'm going to type in text and then I'll say this was within budget. And so what you'll
see is if it's true, it'll say within budget. And then if it's false, I'll say over budget,
and then I'll put a little dash in and say, investigate. So I'm in compliance and I'm the
fun police here because I get to look at all these expenses and see where employees might
have overspent. Now, what I could do is here. I typed in text. If it's true, I also typed in text.
If it's false, but what I could do is I could also have it, you know, I could type in a formula
here. I can basically do whatever I want if it's true or if it's false, but I just want to do a
simple example here where I show text. Now I'm going to click on. Okay. And you'll see here that
will 525 is less than 600. So yep, it's within budget. If I look up here now at the, if formula,
you can see how it says, if C2 is less than B2 comma, then this is what I do if it's true.
And then another comma, this is what I do if it's false. So that's the, that's the layout
of the formula. You could also type it in. If you don't want to use the little insert function
guide. Now that I've typed in my formula, well, you know, I could go through and I could type
in the formula for each and every single one. But once again, I'm looking at these expense reports
all day long and I would love to make my life a little easier. So what I can do is there's this
little box in the bottom right-hand corner. I'm just going to double click on that. And that'll
drop that same formula all the way down to all of my rows. And what you'll see happen is here,
if I click on the formula, it's doing the calculation with these two. If I click on
this next row, you'll see that it's doing the calculation on these two columns. And then
similarly, if I click on the third one, I could see that yes, 1500 is a lot higher than 250.
So this one, I'll probably have to investigate this because we only budget 250 for entertainment
and this employee went way over. Now, what you can also do, which is kind of fun too,
is if it's false, you could also even insert another if function here. So this is called
a nested if. So then I could say, well, if it's 500 above, maybe I say investigate. And if it's
only say a hundred above, then, you know, maybe I don't need to investigate. So you could get
really complex with if statements where you could have multiple if statements within one
statement here. So you could get some pretty complex logic going. But what I wanted to do
is just show you how to use a basic if function in Microsoft Excel. Well, there you have it.
That's how you use the basic if function in Microsoft Excel. It's pretty versatile. You
could do a lot with it. That's why it's one of the most popular functions in Excel. If you learned
how to use if, and you're putting it to good use, please give this video a thumbs up. If you want
to see more videos like this in the future, maybe some additional functions in the future,
hit that subscribe button. That way you get a notification anytime new videos like this come
out. And lastly, if there are any other topics you want to see me cover in the future, leave a
comment down below. I'll take a look and I'll add it to my list of videos to create in the future.
All right. Well, that's all I had for you today. I'll see you next time. Bye.
