This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 65,270 times.
Learn more...
This wikiHow teaches you how to create a logical formula using nested IF statements in Microsoft Excel. The formula you create will use the following syntax: =IF(condition1, value_if_true1, IF(condition2 value_if_true2, value_if_false2)
Steps
-
1Open Microsoft Excel. You’ll find it in the Applications folder on a Mac, or the Start/Windows menu on a PC.
-
2Click Blank Document. If Excel already opened to a blank spreadsheet, you can skip this step. For this article, we’ll work with a blank document to create an example formula.
- In this example formula, we’ll say that if the value of A1 is greater than 5, multiply it by 1. If the value is less than or equal to 5, multiply it by 2.
- The end result of this formula will look like this: =IF(A1>5, A1*1, IF (A1<5, A1*2, A1*2))
Advertisement -
3Type 2 into A1 and press ↵ Enter.
-
4Double-click cell B1. This is where you’ll type the example formula.
-
5Type =IF( into the cell. This starts the formula.
-
6Type the first condition, followed by a comma. This is the first test you’ll be performing.
- In our example, we want a certain action to occur if the value of A1 is greater than 5. Type A1>5,.
- The formula should now read =IF(A1>5,, which means “if the number inside A1 is greater than 5.”
-
7Type the desired output if true. This is the action you want to occur if the result of the first condition is true.
- In this example, we want the value to be multiplied by 1 if it’s greater than 5. So, type A1*1.
- The formula now looks like this: =IF(A1>5, A1*1. This means “if the value of A1 is greater than five, multiple the value by 1.”
-
8Type a , (comma) and press the spacebar. The formula should now look like this: =IF(A1>5, A1*1,
-
9Type IF( after the space. Now you’re ready to add the second part of the formula.
-
10Type the second condition, followed by a comma. This is the second test you’ll perform on the value of A1.
- In our example, we want to specify an action to occur if A1 is less than 5. So, type A1<5.
- The formula should now read: =IF(A1>5, A1*1, IF(A1<5,.
-
11Type the desired output if true, followed by a comma. This is the action you want to occur if A1 is less than 5.
- In this example, we want the value to be multiplied by 2 if it’s less than 5. So, type A1*2,.
- The formula now looks like this: =IF(A1>5, A1*1, IF(A1<5, A1*2,.
-
12Type the desired output is false. Since we’re doing a greater/less than operation, the only value that could be false is 5, since we’re checking for numbers that are greater or less than 5.
- In our example, we want the equal-to value to be multiplied by 2. So, you’ll type A1*2.
- The formula should now look like this: =IF(A1>5, A1*1, IF(A1<5, A1*2, A1*2. This means that if the value of A1 is equal to 5, it will be multiplied by 2.
-
13Type )). This ends both nested IF statements, as each needs their own “)” mark.
- The formula now looks like this: =IF(A1>5, A1*1, IF(A1<5, A1*2, A1*2)).
-
14Press ↵ Enter. This runs the formula and displays the result in cell B1. The example result should be 4, because the since the value of A1 (which is 2) is less than 5, it has been multiplied by 2.