Formula Friday #13
Formula Fridays are short reads, spotlighting a single formula that you can start using straight away.
Today we will cover the basics of IF statements
There is a lot that can be done with the IF function. A LOT.
From a simple statement of ‘if x is greater than y, put true. If not, put false’.
To something a little more elevated such as ‘if x is greater than y, look to a different data set to find the relevant classification. If not, put false’.
And onto the super complex of, ‘if x is greater than y, and y is less than z, put true. If not look for the classification of z’.
If I have lost you, don’t worry we will cover all of these in their own time. This post is just going to focus on the basics of an IF statement.
The IF Function
It’s like our brain in Excel form.
The first thing you have to do is input the logical test. This is where those mathematical signs you learnt at school come into play. You know the ones ‘<’ less than, ‘>’ greater than, and ‘=’ equal to – I always pronounce this equals to, don’t ask me way.
If you want to get fancy, greater than or equal to is ‘>=’, less than or equal to is ‘<=’ and not equal to is ‘<>’.
Next you need to decide what to do if the logical test is true, and what to do if the logical test is not true, as known as false.
An example formula would look like this
Let’s take it up a notch
You can replace any element of an IF statement with another Function or formula.
So instead of saying IF 10 is greater than 5. You could say if the result of this VLOOKUP is greater than 5. That formula would look like this:
Any text inputs need to be within quotation marks, as with other functions, or the formula will result in an error.
The result if true and the result if false doesn’t have to be a text input. They can also be formulas.
It all depends on what you want the outcome to be.
You can string multiple IF statements together. This is something called a nested if. But we will cover that in a different post as it takes quite a lot of brain power to get your head around.
Until next time