Home » Blog » If Statements

If Statements

Hello everyone! Did you know …… IF statements in Microsoft Excel allow us to make a decision about what value or formula should appear in a cell.


book a session

Explanation

If a condition is met we decide to give the cell one value or formula but if it’s not true we give it a different value or formula. It’s basically an If, Then, Else situation!

Test condition

The first argument of the IF statement is the condition you are testing for. You can use an operator such as =, > or < in your test, if comparing cells, e.g. =IF(D6=$A$1,. If the test is satisfied you get the answer TRUE (also known as 1) but if the test fails the answer is FALSE (also known as 0). The answer can only be either TRUE or FALSE. It cannot be both!

Arguments 2 & 3

The two remaining arguments in the IF statement in Microsoft Excel are: Firstly, what will the value or formula in the cell be if the answer to the test is TRUE and secondly, what will the value or formula in the cell be if the answer to the test is FALSE.

Example

An example IF statement could be:

=IF(D6=$A$1,”Super”,”Terrible”)

Nested IF statements (or would Vertical Lookup not be better ?)

A special type of IF statement is the Nested IF statement for situations in which you would like to choose from more than two possible values or formula. This is where you start entering IF statements within IF statements in arguments 2 & 3. I’ll leave that for another day or maybe you could just try the alternative Vertical Lookup instead!

Additional Info

If we wanted to convert our If Statement above into a Vertical Lookup type situation we would first create a separate lookup table:

For example, if the figure to check was “500” we could set up a new Table called “Table_A” and under the first column in the table key in “500” and in the adjacent cell to the right in the second column enter “Super”.

 

Then set up the Vertical Lookup formula as follows:

=IFERROR(VLOOKUP(D6,Table_A,2,0),”Terrible”)

 

Of course, the Vertical Lookup approach (without IFERROR) would make a lot of sense if we had a list of possible result values and not just two.

Get spreadsheet



book a session

Leave a Reply

Your email address will not be published. Required fields are marked *