The IF-THEN function in Excel is a powerful way to add decision making to your spreadsheets. It tests a condition to see if it's true or false and then carries out a specific set of instructions based on the results.

For example, inputting an IF-THEN in Excel, you can test if a specific cell is greater than 900. If it is, you can make the formula return the text "PERFECT." If it isn't, you can make the formula return "TOO SMALL."

There are many conditions you can enter into the IF-THEN formula. Here's how to use the IF-THEN function in Excel as well as a few examples.

Instructions in this article apply to Excel 2016, 2013, 2010; Excel for Mac, and Excel 365/Online.

## Inputting IF-THEN in Excel

The syntax of the IF-THEN function includes the name of the function and the function arguments inside of parenthesis.

This is the proper syntax of the IF-THEN function:

=IF(logic test,value if true,value if false)

The IF part of the function is the logic test. This is where you use comparison operators to compare two values.

The THEN part of the function comes after the first comma and includes two arguments separated by a comma.

- The first argument tells the function what to do if the comparison is true.
- The second argument tells the function what to do if the comparison is false.

## A Simple IF-THEN Function Example

Before moving on to more complex calculations, let's look at a very simple example of an IF-THEN statement.

Our spreadsheet is set up with cell B2 as $100. We can input the following formula into C2 to indicate whether or not the value is larger than $1000.

=IF(B2>1000,"PERFECT",

This function has the following arguments:

**B2>1000**tests whether the value in cell B2 is larger than 1000.**"PERFECT"**returns the word PERFECT in cell C2 if B2**is**larger than 1000.**"TOO SMALL"**returns the phrase TOO SMALL in cell C2 if B2**is not**larger than 1000.

The comparison part of the function can compare only two values. Either of those two values can be:

- Fixed number
- String of characters (text value)
- Date or time
- Functions that return any of the values above
- A reference to any other cell in the spreadsheet containing any of the above values

The TRUE or FALSE part of the function can also return any of the above. This means that you can make the IF-THEN function very advanced by embedding additional calculations or functions inside of it (see below).

When inputting true or false conditions of an IF-THEN statement in Excel, you need to use quotation marks around any text you want to return, unless you're using TRUE and FALSE, which Excel automatically recognizes. Other values and formulas don't require quotation marks.

## Inputting Calculations Into the IF-THEN Function

You can embed different calculations for the IF-THEN function to perform, depending on the results of the comparison.

In this example, one calculation is used to calculate tax owed, depending on the total income in B2.

The logic test compares total income in B2 to see if it's greater than $50,000.00.

=IF(B2>50000

In this example, B2 is not larger than 50,000, so the "value_if_false" condition will calculate, and return that result.

In this case that's **B2*0.10**, which is **4000**.

The result is placed into cell C2, where the IF-THEN function is inserted, will be 4000.

You can also embed calculations into the comparison side of the function.

For example, if you want to estimate that taxable income will only be 80% of total income, you could change the above IF-THEN function to the following.

=IF(B2*0.8>50000

This will perform the calculation on B2 before comparing it to 50,000.

Never enter a comma when entering numbers in the thousands. This is because Excel interprets a comma as the end of an argument inside of a function.

## Nesting Functions Inside of an IF-THEN Function

You can also embed (or "nest") a function inside of an IF-THEN function.

This lets you perform advanced calculations, and then compare the actual results to the expected results.

In this example, let's say you have a spreadsheet with the grades of 5 of your students in column B. You could average those grades using the AVERAGE function. Depending on the results of the class average, you could have cell C2 return either "Excellent!" or "Needs Work".

This is how you would input that IF-THEN function:

=IF(AVERAGE(B2:B6)>85,"Excellent!","

This function returns the text "Excellent!" in cell C2 if the class average is over 85. Otherwise, it returns "Needs Work".

As you can see, inputting the IF-THEN function in Excel with embedded calculations or functions allows you to create very dynamic and highly functional spreadsheets.