Logical Functions

You can use Excel's logical functions to evaluate conditions and act accordingly. Here's the most useful one: IF.

The IF function

The IF function evaluates a condition and returns one of two different values depending on whether the condition is met (true) or not met (false). It uses the following syntax:

IF(logical_test,value_if_true,value_if_false)

The logical_test argument is the condition you want to meet. This argument is required. The value_if_true and value_if_false arguments are the values to return if the condition is met or not met. If omitted, the values TRUE and FALSE are returned.

The following example uses the IF function to calculate commissions based on two different commission rates.

To use the IF function

Get Microsoft Excel X for Mac OS X: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.