Excel: How to Use IF Function with Multiple Conditions


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

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

=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.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Create IF Function to Return Yes or No
Excel: How to Use an IF Function with Range of Values
Excel: How to Use a MULTIPLY IF Function

Featured Posts

Leave a Reply

Your email address will not be published. Required fields are marked *