**Using the Excel IF Function**

## Summary

The IF function is one of the most popular functions in Excel. The logical function IF allows you to make a logical comparison between two values. The function will allow you to specify the logical argument, the return result if true and the return result if false. To increase the power of the IF function is can be combined with other logical functions such as AND and OR.## Syntax

=IF(logical_test, value_if_true, [value_if_false])## Syntax Breakdown

**logical_test**The logical_text argument is the condition that you would like to test. The argument must be capable of evaluating to a true or false answer.

**value_if_true**Value_if_true is the user specified value that will be returned if the logical_test is true.

**value_if_false**Value_if_false is the user specified value that will be returned if the logical_test is false.

## Usage Notes

**Text and Values**The IF function is capable of evaluating logical arguments provided as either text or numbers.

**Using Mathematical Calculations in IF**IF is a very useful function. Value_if_true and value_if_false can be mathematical calculations which can be very powerful.

The above example is saying: IF hours worked is greater than hours allotted then find the difference between the two. IF hours worked is not greater than hours allotted then return no overtime. You can see the power of the IF function if you have a spreadsheet that contains employee work hours and need to quickly see who worked overtime hours and how many.

**Nested IFs**Nested IF or nested IF statements allow you to test multiple conditions and return more possible results. A nested IF statement involves using an IF function within another IF function (you can "nest" up to 64 IF statements). When working with nested IF statements it is necessary to be diligent to ensure that the logic executes as you intended. If you find that you require more complex operations you may consider using the VLOOKUP or HLOOKUP functions.

The following are logical operators that can be used when testing conditions in an IF statement:

**Common Errors**The #NAME? error is typically returned when the formula is misspelled. Check to ensure that you entered FALSE correctly.

If the value_if_true or value_if_false arguments do not have a value you will receive a zero (0) in the cell. To resolve, simply add values for the arguments in the function.