How to use IF Function with Multiple Conditions in Excel?

The IF function in Excel can be used to check multiple conditions by nesting the IF functions together. This is done by adding an IF function as the logical test argument of another IF function. Each IF function checks a condition and the result of the condition determines which of the subsequent IF functions is used to determine the final result. The maximum number of IF functions that can be nested together is 64. It is important to understand the order of operations when nesting IF functions together to ensure the correct result is achieved.


You can use the following formulas to create an IF function with multiple conditions in Excel:

Method 1: Use IF Function to Test if Multiple Conditions are Met

=IF(AND(B2="Guard",C2>20),"Yes", "No")

For this formula, if cell B2 is equal to “Guard” and cell C2 is greater than 20, then the function returns “Yes.” Otherwise it returns “No.”

Method 2: Use IF Function to Test if One of Several Conditions are Met

=IF(OR(B2="Guard",C2>20),"Yes", "No")

For this formula, if cell B2 is equal to “Guard” or cell C2 is greater than 20, then the function returns “Yes.” Otherwise it returns “No.”

The following examples show how to use each formula in practice with the following dataset in Excel:

Example 1: Use IF Function to Test if Multiple Conditions are Met

We can type the following formula into cell D2 to return “Yes” if the value in the Position column is “Guard” and the value in the Points column is greater than 20:

=IF(AND(B2="Guard",C2>20),"Yes", "No")

We can then click and drag this formula down to each remaining cell in column D:

Excel IF function multiple conditions using AND logic

The formula returns “Yes” for each row where the value in the Position column is “Guard” and the value in the Points column is greater than 20.

If both of these conditions aren’t met in a given row, then the formula returns “No” instead.

Example 2: Use IF Function to Test if One of Several Conditions are Met

=IF(OR(B2="Guard",C2>20),"Yes", "No")

We can then click and drag this formula down to each remaining cell in column D:

The formula returns “Yes” for each row where the value in the Position column is “Guard” or the value in the Points column is greater than 20.

If neither of these conditions are met in a given row, then the formula returns “No” instead.

Note that in both examples, we checked if two conditions were met.

However, you can place as many conditions as you’d like in the AND() or OR() functions depending on how many conditions you’d like to check.

x