# Getting started with IF statements

## 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

=IF(10>5,”Y“,”N“) ##### 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:

=IF(VLOOKUP(A2,A8:B15,2,0)>5,”Y“,”N“)

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.

=IF(VLOOKUP(A2,A8:B15,2,0)>5,VLOOKUP(A2,C8:D15,2,0)*10,VLOOKUP(A2,C8:D15,2,0)/10)

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

Ax ## 3 replies on “Getting started with IF statements”

[…] hand, will typically make up part of the formula to test. It’s frequently nested inside of an IF statement like […]

[…] IF statements are one of the most useful tools in Excel. Whether they are used on their own, nested together or alongside other functions such as the AND/OR Functions. You are guaranteed to get clearer data insights. And be able to quickly identify your data categories. […]

[…] nested IF is a formula that combines two or more IF statements. More specifically, one, or more, IF statements are contained inside of another IF statement. And […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.