# Multiple IF Statements in Excel (Nested IF Functions)

The IF function is an awesome logical function of Excel. When used the right way, it will offer results that will leave you fascinated 🤩

The IF function, by default, tests a single logical condition. But with the classic nesting of the IF function, you can make it test multiple conditions at the same time.

Not only that, but you can also run it under the AND & the OR logics. How?

To learn that, continue reading and make sure you’ve downloaded our free sample workbook for this guide here. It will help you practice the examples discussed below 📩

## What are nested IF functions?

A nested IF function is where multiple IF functions are nested within each other.

Practically, it’s an IF function nested in the place of the value_if_false argument of another IF Function. And so on.

A classic nested IF function looks like the one below 👇

IF (logical_criteria1, value_if_true, IF (logical_criteria2, value_if_true, IF (logical_criteria3, value_if_true, value_if_false ) ) )

In place of the value_if_false argument of each IF function, another IF function is nested.

Pro Tip!

Seems like a complex formula? Here’s how it works:

• Excel evaluates the first logical test. If it is true, Excel returns the value_if_true of the first IF function.
• If it turns false, Excel runs the second logical test. If the second logical test turns true, Excel returns the value_if_true of the second IF function.
• If the second logical test turns false, Excel runs the third logical test, and the cycle continues until the last IF function 🔁

Under the AND logic, a classic nested IF function looks like this:

IF ( logical_criteria1, IF ( logical_criteria2, value_if_true, value_if_false), value_if_false)

This time, an IF function is nested in place of the value_if_true argument of each IF function.

Pro Tip!

Here’s how this function works 💭

• Excel evaluates the first logical test. If it is false, Excel returns the value_if_false for of first IF function. But if it is true, Excel runs the second logical test.
• If the second logical test turns false, Excel returns the value_if_false for of second IF function. And if the logical test of the second IF function turns true, Excel returns the value_if_true of the second function.

## Multiple IF statements with AND logic (restrictive)

AND logic means that the IF function must return the value_if_true only if all the specified conditions are true. Let’s run an example to see how this works.

XYZ institute has a stern criterion for admitting students 🎓 For any student to get admission, he must:

• Be taller than 5 feet; and
• Have an IQ score higher than 140.

Let’s write the IF function to test both these conditions with the AND logic 💪

1. Write the IF function as follows:

=  IF (B2>5 The first criterion of B2 > 5 tells Excel to check if the value in Cell B2 (the height) is greater than 5.

1. As the value_if_true, nest another IF function.
2. For the logical test of the second IF function, write the second condition (IQ score > 140).

=  IF (B2>5, IF (C2>140 The logical test of C2 > 140 tells Excel to check if the value in Cell C2 (IQ score) is greater than 140 🧠

1. Write the value_if_true for the second logical test.

=  IF (B2>5, IF (C2>140, “Admission Granted” We have written the value_if_true as “Admission Granted” in double quotation marks.

1. Write the value_if_false for the second logical test.

=  IF (B2>5, IF (C2>140, “Admission Granted”, “Rejected due to IQ score” As the value_if_false of the second IF function (logical test of C2>140), we are writing “Rejected due to IQ score”

1. Close the parenthesis (we are done writing the nested IF function) and write the value_if_false of the first IF function.

=  IF (B2>5, IF (C2>140, “Admission Granted”, “Rejected due IQ score”), “Rejected due to height”) 1. That’s all – Hit Enter. Excel returns “Admission Granted“, and the results make much sense.

Student A meets both the criteria for Scholarship: he is 5.4 feet tall and has a whopping IQ of 150 🤩

1. Drag and drop the results to the entire list. There we go! We have the admission results for the entire list.

## Multiple IF statements with OR logic (open)

We’ve seen how the IF function works under the AND logic. Now let’s see if the same works under the OR logic.

OR logic means that the IF function must return the value_if_true if any of the specified conditions are true 🧐

We are going with the same previous example. But this time, for any student to get admission, he must:

• Be taller than 5 feet; or
• Have an IQ score higher than 140.

Let’s write the IF function to test both these conditions with the OR logic.

1. Write the IF function with the first logical test (Height > 5 feet).

=  IF (B2>5, 1. Define the value_if_true of the first IF function. We are setting it to “Admission Granted” 📔

1. As the value_if_true, nest in another IF function and write the second logical test (Height > 140).

=  IF (B2>5, “Admission Granted”, IF (C2>140, 1. Write the value_if_true for the second IF function. We are again setting it to “Admission Granted” as any student who meets any of these criteria will get admission 🚀

1. Write the value_if_false for the second IF function. We will get the value_if_false (“Rejected”) under the OR logic only if both criteria fail to meet. So there’s no distinction between being Rejected due to IQ or Height. Let’s simplify it to “Rejected“.

1. Close the second IF function with parenthesis.
2. And then, add another parenthesis to close the first IF function too.

1. That’s all – Hit Enter 🤟 Excel again returns “Admission Granted“, but this time Student A didn’t meet both criteria.

He is 5.4 feet tall (taller than 5 feet) but only has an IQ of 120 (less than 140). This is because this time we were running the OR logic.

1. Drag and drop the results to the entire list. And here we have the admission results for the entire list with the OR logic 🎯

## Nested IF formula with both AND + OR logic

Now let’s try running a function with the AND & OR logic simultaneously. Yes, that might sound a little confusing but, you’d enjoy it to the core.

To do this, we will still use the same dataset as above with a little change 👀 Only those students shall stand eligible for admission who:

• Have an IQ of more than 140; AND
• Are taller than 5 feet; OR
• Have a weight lesser than 80 Kg.

The story has a little twist – the admission criteria now necessitate an IQ score of more than 140. And of the other two conditions, anyone needs to be met 🥇

Let’s write the IF function to test both these conditions with the AND & OR logic.

1. Start writing the IF function with the AND condition first (the condition that must be met).

=  IF (B2>140, The mandatory condition for admission is an IQ score higher than 140 so we have written that first.

1. Nest another IF function as the value_if_true of the first IF function.
2. Write the logical test for the second IF function as C2>5 (height >5) and define the value_if_true.

=  IF (B2>140, IF (C2>5, “Admission Granted”, Done with the mandatory (AND condition). Now let’s move on to the OR conditions. We will nest them in place of the value_if_false of the last IF function 😎

1. Nest another IF function as the value_if_false of the second IF function.

=  IF (B2>140, IF (C2>5, “Admission Granted”, IF (D2<80, “Admission Granted”, “Rejected due to Height or Weight”) As the third IF function, the logical test is set to less than 80Kgs (D2<80) with the relevant value_if_true and value_if_false.

1. We are done writing our second and third IF functions. Add two parentheses to close them.
2. Write the value_if_false of the first IF function to conclude the following formula:

=  IF (B2>140, IF (C2>5, “Admission Granted”, IF (D2<80, “Admission Granted”, “Rejected due to Height or Weight”)), “Rejected due to IQ”) 1. Hit Enter. Excel again returns “Admission Granted” as Student A 👇

• Has an IQ score of 150 (more than 140)
• He is 4.8 feet tall (not more than 5 feet)
• But he weights 75 Kgs (less than 80 Kgs)

So, he meets the mandatory criteria and one of the two OR criteria – so he’s in.

1. Drag and drop the results to the entire list. This time the admission results are based on both the AND & OR logic.

## Multiple IF statements with the actual AND/OR functions

Did you know? You can also make the IF function run under the AND & OR logic by using the AND & OR functions too. No nesting is needed 🐤

Let’s write the IF function together with the AND function to see which students are granted Admission this time.

For any student to get admission, he must:

• Be taller than 5 feet; and
• Have an IQ score higher than 140.

To check that:

1. Write the AND function as follows:

=  AND(B2>5, C2>140) We have defined both the logical tests (criteria above) as the arguments of the AND function 👩‍🎓

1. Hit Enter and you will get these results: We get FALSE as one of the above conditions is not met. Student A is not taller than 5 feet.

1. Wrap the function above in the IF function as follows:

= IF (AND (B2>5, C2>140), “Admission Granted”, “Rejected”) 1. Hit Enter. Same as the nested IF works under the AND Logic. You can do the same for the OR logic using the OR function 💁‍♀️

1. Simply replace the AND function in the formula below with OR.

= IF (OR (B2>5, C2>140), “Admission Granted”, “Rejected”) 1. Hit Enter. Student A meets one condition: he has an IQ score higher than 140 ✌

## That’s it – Now what?

The guide above has taught us how to nest multiple IF functions together under the OR & AND logic. You can do so by using the AND & OR functions but, that’s not necessary.

You can also use multiplication and addition operators to make this happen. Hope you enjoyed learning about nesting the IF function 🧐

If you did, let me tell you there’s so much more for you to learn about Excel functions. The Excel functions library is full of similar amazing functions.

To begin learning, I suggest you go with the basic Excel functions like the VLOOKUP, SUMIF, and IF functions.

Click here to register for my 30-minute free email course that will walk you through these (and many more) functions of Excel.

## Other resources

IF functions are so versatile that you’d find a list of functions paired with them in Excel by default. Like the AVERAGEIF function, SUMIF function, and COUNTIF function.

Read our other blogs on them to learn how to use them.