The IF statement is also known as a logical formula: IF, then, else. **If** something is true,**then** do this, **else**/otherwise do that. For example, **if** it’s raining, **then** close the windows,**else**/otherwise leave the windows open.

The syntax (or sentence structure; that is, the way the commands are organized in the formula) of an Excel IF statement is: =IF(logic_test, value_if true, value_if_false). IF statements are used in all programming languages and, although the syntax may vary slightly, the function provides the same results.

Remember: Learning Excel functions/formulas and how they work are the first steps toward using Visual Basic, Microsoft’s event-driven programming language. Here are five easy IF statements to get you started.

## Past-due notices

In this spreadsheet, the customer’s payment due date is listed in column A, the payment status is shown in column B, and the customer’s company name is in column C. The company accountant enters the date that each payment arrives, which generates this Excel spreadsheet. The bookkeeper enters a formula in column B that calculates which customers are more than 30 days past due, then sends late notices accordingly.

A. Enter the formula: `=TODAY()`

in cell A1, which displays as the current date.

B. Enter the formula: `=IF(A4-TODAY()>30, “Past Due”, “OK”)`

in cell B4.

In English, this formula means: **If** the date in cell A4 minus today’s date is greater than 30 days, **then** enter the words ‘Past Due’ in cell B4, **else**/otherwise enter the word ‘OK.’ Copy this formula from B4 to B5 through B13.

## Pass/Fail lifeguard test

The Oregon Lifeguard Certification is a Pass/Fail test that requires participants to meet a minimum number of qualifications to pass. Scores of less than 70 percent fail, and those scores greater than that, pass. Column A lists the participants’ names; column B shows their scores; and column C displays whether they passed or failed the course. The information in column C is attained by using an IF statement.

Once the formulas are entered, you can continue to reuse this spreadsheet forever. Just change the names at the beginning of each quarter, enter the new grades at the end of each quarter, and Excel calculates the results.

A. Enter this formula in cell C4: `=IF(B4<70,”FAIL”,”PASS”)`

. This means if the score in B4 is less than 70, **then** enter the word *FAIL* in cell B4, **else**/otherwise enter the word*PASS*. Copy this formula from C4 to C5 through C13.

## Sales & bonus commissions

Wilcox Industries pays its sales staff a 10-percent commission for all sales greater than $10,000. Sales below this amount do not receive a bonus. The names of the sales staff are listed in column A. Enter each person’s total monthly sales in column B. Column C multiples the total sales by 10 percent, and column D displays the commission amount or the words ‘No Bonus.’ Now you can add the eligible commissions in column D and find out how much money was paid out in bonuses for the month of August.

A. Enter this formula in cell C4: `=SUM(B4*10%)`

, then copy from C4 to C5 through C13. This formula calculates 10 percent of each person’s sales.

B. Enter this formula in cell D4: `=IF(B4>10000, C4, “No bonus”)`

, then copy from D4 to D5 through D13. This formula copies the percentage from column C for sales greater than $10,000 or the words ‘No Bonus’ for sales less than $10,000 into column D.

C. Enter this formula in cell D15: `=SUM(D4:D13)`

. This formula sums the total bonus dollars for the current month.

## Convert scores to grades with nested IF statements

This example uses a “nested” IF statement to convert the numerical Math scores to letter grades. The syntax for a nested IF statement is this: IF data is true, then do this; IF data is true, then do this; IF data is true, then do this; IF data is true, then do this; else/otherwise do that. You can nest up to seven IF functions.

The student’s names are listed in column A; numerical scores in Column B; and the letter grades in column C, which are calculated by a nested IF statement.

A. Enter this formula in cell C4:`=IF(B4>89,”A”,IF(B4>79,”B”,IF(B4>69,”C”,IF(B4>59,”D”,”F”))))`

, then copy from C4 to C5 through C13.

**Note:** Every open, left parenthesis in a formula must have a matching closed, right parenthesis. If your formula returns an error, count your parentheses.

## Determine sliding scale sales commissions with nested IF statements

This last example uses another nested IF statement to calculate multiple commission percentages based on a sliding scale, then totals the commissions for the month. The syntax for a nested IF statement is this: IF data is true, then do this; IF data is true, then do this; IF data is true, then do this; else/otherwise do that. The names of the sales staff are listed in column A; each person’s total monthly sales are in column B; and the commissions are in column C, which are calculated by a nested IF statement, then totaled at the bottom of that column (in cell C15).

A. Enter this formula in cell C4:`=IF(B4<5000,B4*7%,IF(B4<8000,B4*10%,IF(B4<10000,B4*12.5%,B4*15%)))`

, then copy from C4 to C5 through C13.

B. Enter this formula in cell C15: `=SUM(C4:C13)`

. This formula sums the total commission dollars for the current month.