# Using IF statements in Excel

Conditional statements using the

To give you some inspiration on how the

- Modify the
Price column of a product based on the name of that product; - Tag a
Customer type column based on a particular customer's name; - Perform one action if the
City of a user's hometown is set to "San Francisco", and an entirely different action if it is set to "Boston"; - And lots more!

Read on to find out how to use this powerful tool.

## The basic IF statement

The syntax of a basic

=IF (logical_expression ,value_if_true ,value_if_false )

If the

Let's take a look at an actual

=IF (TRUE ,1 ,0 )

Output:1

=IF (FALSE ,1 ,0 )

Output:0

In the first example above, the formula outputs the value

In the second example, the formula outputs the value

Of course, the

=IF (7 <3 ,"Correct answer!" ,"Incorrect answer" )

Output:"Incorrect answer"

In the above example, Excel first evaluates the logical expression

## Referencing foreign cells

Static logical equations are just the beginning of the power of the

Can we design a formula that will dynamically output a message based on whether these sales goals were met?

First, we'll need to add an input cell that tells us what the sales goal for this quarter is. Then, we'll design a separate set of input cells that tell us what message to give our sales representatives based on their quarterly numbers.

Check out our completed solution below:

=IF (SUM (C3:C5 )>=F2 ,F3 ,F4 )

Step 1: =IF ($22,000,000 >=$20,000,000 ,F3 ,F4 )

Step 2: =IF (TRUE ,F3 ,F4 )

Output:Great job!

In the above formula, we first tell Excel to take the

## Nested IF functions

To take things one step further, we can also nest

Let's say we want to add a column that groups these cities by region. Anything in Boston or New York should fall into the "Northeast" region; anything in Chicago should fall into the "Midwest" region; and anything else should fall into the "Other" region. Let's design a nested

=IF (OR (C3 ="Boston" ,C3 ="New York" ),"Northeast" ,IF (C3 ="Chicago" ,"Midwest" ,"Other" ))

Output:"Northeast"

What's going on in the above equation? First, Excel checks to see if the value in cell

Notice that we've used the same formula for every row in this table. We can do that because we haven't locked the row number, so as we copy the formula down into additional cells, the row number changes to accommodate. The formula in cell

Now that you have a handle on the basics of the

## Save an hour of work a day with these 5 advanced Excel tricks

Work smarter, not harder. Sign up for our 5-day mini-course to receive **must-learn lessons** on getting Excel to do your work for you.

- How to create
**beautiful table formatting**instantly... - Why to
**rethink the way you do VLOOKUPs**... - Plus, we'll reveal
**why you shouldn't use PivotTables**and what to use instead...