
Tips.Net > ExcelTips Home > Worksheet Functions > Logical Functions > Using the IF Worksheet Function
Summary: Programmers know that a staple of any language is the ability to create conditional statements. Excel understands this, as well, so it provides the IF worksheet function that allows you to evaluate an expression and thereby conditionally choose a result. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)
Excel provides a wide range of worksheet functions you can use. One of the most versatile worksheet functions is IF. This function allows you to test some condition, and then use a value if the condition is true or a different value if the condition is false. For instance, consider the following example:
=IF(A2Notice that IF requires three arguments, each separated by commas. The first argument (in this example, A2
You are not limited, of course, to returning strings in an IF function. You can return any value you want, including the values stored in other cells. For example:
=IF(A2In this case, if A2 is less than C2, then the value derived by subtracting B7 from B6 is returned. If A2 is not less than C2, then the value 43 is returned.
Tip #2347 applies to Microsoft Excel versions: 97 2000 2002 2003 2007
Tame Your Data! ExcelTips: Filters and Filtering provides all the details necessary to let you manage large sets of data with confidence and ease. Its information-packed pages demonstrate how to use the two types of filters provided by Excel: AutoFilters and advanced filters.
Check out ExcelTips: Filters and Filtering today!
Have thousands of ExcelTips at your fingertips, on your own system. Answer your own questions or help support others. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site