How to Insert Multiple IF Functions in MS Excel
You may already be familiar with the IF function in Excel. It operates on a simple principle: you specify the condition you want to test, an outcome if the test turns out to be true and an outcome if the test turns out to be false. However, if you have a more complex situation and need more than two outcomes, you can use "nested" IF functions. Nesting involves substituting another IF function for either the true or the false outcome, or even for both.
Open the Excel spreadsheet with values you want to test.
Click on an empty cell to begin building your IF functions.
Enter: =IF("logical test",Where it says "logical test," insert your test. For example, you could insert "A2>100" if you want to test whether cell A2 is greater than 100.
Enter the second IF function instead of the value you want to display for true. You will need to enter another logical test for the second IF function. For example:=IF(A2>100,IF("new logical test",Where it says "new logical test," insert your second test if the first test turns out to be true. For example, let's say that A2 is greater than 100 but you also want to know whether it's much greater than 100. Your new logical test might be, "A2>1000."
Enter the value you want to display if the new result is true and if the new result is false in quotes, separated by commas. Close the nested IF function with a parenthesis and add a comma:=IF(A2>100,IF(A2>1000,"very high","moderate"),For example, if A2 turns out to be higher than 1000, you may want to display the message, "very high" but display the message "moderate" if the value is not above 1000. Keep in mind that because you have nested a second IF instead of the "true" in the first IF function, your "moderate" result now refers to a number greater than 100 but less than 1000.
Enter the value you want to see if the result of the first test is false. Close the parenthesis. In this example, A2 would have be equal to or less than 100 to get a false result -- that is, an outcome of "low." =IF(A2>100,IF(A2>1000,"very high","moderate"),"low")
Tips & Warnings
- You can keep entering new IF statements instead of the value for "true" or "false." Remember to close each parenthesis as you finish a nested IF statement.