
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
Save Time and Money! Many people need to keep track of employee time, but don't know where to start when it comes to creating a spreadsheet. Here's a way to save time, effort, and money with ready-to-use timesheet templates.
Check out Timesheet Templates today!
Add power to your purpose with Excel. A comprehensive 500+ page e-book explains everything you need to know about macros. (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