# Using If Statements in Excel

Conditional logic(IF) is used quite frequently in modern spreadsheets. But let's start by asking What is Conditional Logic?

## Conditional Logic

For our purposes, conditional logic is two words - "IF" and "Then". You use conditional logic all the time in your daily life, without realising it. You might say to yourself, "IF I eat this delicious cream cake THEN my diet will be ruined." You're using conditional logic to make a decision: IF I do this THEN that will happen. Some more examples:

IF I buy this lovely coat THEN I will look beautiful

IF I watch one programme THEN I can tape the other

IF I win the lottery THEN I will be happy

Those are all example of conditional logic. Excel also uses the IF word for conditional logic. You can test what is in a cell, and say what should happen if it is one value rather than another. For example, suppose cell A1 has the number 6 in it. In cell A2, you can enter an IF function to test whether cell A1 is above 5 or below 5. IF

it is above 5 THEN one thing happens; IF it is below 5 THEN another thing happens.

The correct format to use for the IF function is this:

IF( logical_test, value_if_true, value_if_false )

So the IF function takes three arguments: logical test. value if true. value if false. Let's break those three arguments down a little more:

Logical Test: This is what you want to test for. In our example, we wanted to test whether cell A1 is greater than or less than 5. Excel uses this symbol > for greater than and this symbol 5 Value If True: This is the THEN part of the IF statement. Excel needs to know what you want to happen IF your condition is met. You can put in text surrounded by quotes, or another formula. Value If False: You also need to say what should happen IF your condition is not met.

Let's clarify all this with a spreadsheet example. So, start a new spreadsheet and do the following:

Click inside cell A1 and enter the number 6

Press the return key on your keyboard

Source: www.homeandlearn.co.uk

Category: Forex