# Change the Output of a Cell in Excel Based on Other Values (IF Statement in Excel)

This article covers how to use an IF statement in Excel in order to change the output of a cell.

The basic premise here is that IF statements allow you to choose what you want to happen based on different conditions within Excel.  You can use the IF statement to do something as simple as to output "Yes" if another cell contains a value greater than say 10; and, you can also use it to check the output of complicated mathematical formulas, dates, times, Vlookup results, etc.  Basically, you can use an IF statement to make a decision within the spreadsheet.

The syntax for an IF statement is like this:

=IF(logical_test, [value_if_true], [value_if_false])

Remember that the IF statement is just a function in Excel.  So, you must always start it with an equals sign.  After that, there are only 3 arguments.

The logical_test is the only required argument and it is where the decision is made (basically).  For the logical_test you must input something that will evaluate to either TRUE or FALSE - Basically Yes or No.  This will evaluate statements like this - "Is 5 greater than 10?" - "Is January 5, 2012 a Holiday?" - etc.  For this argument, you will input the tests using (mostly) either =,<,>.  So, is 5 greater than 10 would be written "5>10" for the logical_test.

Once you have the logical test, you can input values for value_if_true and value_if_false.  If the logical_test evaluates to TRUE, whatever is placed in the value_if_true argument will be output. If the logical_test evaluates to FALSE, whatever is placed in the value_if_false argument will be output.  If you put nothing for these arguments, the output will be either TRUE or FALSE by default.

So, here is what a completed IF statement would look like:

=IF(5>10,"It's Opposite Day","Five is Less than Ten.")

Here is how you read this:  If 5 is greater than ten, output "It's Opposite Day" otherwise output "Five is Less than Ten."  Note that you must put double quotes around any text that you want to output.  If you want to output a number, you do not need to use quotation marks.

Now, this is a pretty simple overview of how to use an IF statement.  In other tutorials you'll learn how to nest IF statements within each other, how to nest other functions and formulas within IF statements and more.

Similar Topics - Q/A from Forums