1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Using the IF Function to Enter Text

Excel IF Function Tutorial

By

Man typing on keyboard, close-up of fingers
Photodisc/Getty Images

What the IF function does

The IF function is one of Excel’s most useful and most used functions. What it does, basically, is test to see whether a certain condition is true or false. If the condition is true, the function will do one thing, if the condition is false, the function will do something else.

The basic form or syntax of the function is:

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

The logic test is always a comparison between two values. Comparison operators are used, for example, to see if the first value is greater than or less than the second, or equal to it.

While the logic test section is limited to answering a true or false question, you have greater flexibility in what you place in the last two arguments.

Displaying text

Having text displayed by an IF function rather than a number can make it easier to find and read specific results in the spreadsheet.

Below, the example IF function is setup to test whether a student's mark is greater than or equal to 50. If it is, "Passed" is written into the target cell. If not, the word "Failed" appears.

=IF(A5>=50,”Passed”,”Failed”)

A second example could be used by a company to quickly determine which employees are entitled to a bonus for exceeding a certain level of production.

=IF(A5>=5000,”Pay Bonus”,”No Bonus”)

Note: when you want to use text in an IF function each text statement must be enclosed in quotes, such as "Pay Bonus".

Also, notice that there is no comma separator in 5,000 in the above example. This is because the IF function uses the comma to separate the three sections of the IF function contained within the round brackets.

If you use a comma as a separator in numbers greater than a thousand, Excel will give you an error message saying you have too many arguments in your function.

Related Tutorials on the IF Function:

©2014 About.com. All rights reserved.