Nested IF and IFS Functions in Excel

Reading time: 3 minutes

Nested IF allows you to create IF statement with more than 2 results. In Excel, you can build nested IF with many functions. In this article, we will present many cases.

How to Create Nested IF Formulas in Excel

The IF function returns a maximum of 2 results according to the result of a logic test: TRUE or FALSE. However, in many situations, the conditions could exceed 2 results.

For instance, we have a database of customers, and some of them have premium statuses. We want to apply a specific percentage discount according to the status

  • Gold (20%)
  • Silver (10%)
  • Bronze (5%)

With the IF function =IF(B2="Gold",20%,5%), we can only create a condition for one value, here ‘Gold’ 🫤 And, of course, the result is false when the value is ‘Silver’, ‘Bronze’, or empty. So, when you must analyse multi-criteria, you must write a nested IF formula in Excel.

With only one IF function we don't cover all situations

How to write a nested IF with the IF function?

Originally, in Excel, this was the only way to manage multiple statements. The secret is to replace the FALSE argument with another IF function to test another situation. For instance, we can write another test in our previous function like this

Nested IF with 3 criteria to evaluate
  • We have 2 IF functions, so we must close 2 parenthesis at the end of the function
  • But it’s still not what we want because we don’t manage the case when the cell Bx is empty.
  • We must write a 3rd IF function like this to cover all cases.
Nested IF with 4 criteria

The formula works, and the result is correct, but such a formula is not easy to write because it’s easy to make mistakes (like forgetting to close the proper number of parenthesis).

This is why, since Excel 2016, Microsoft has created the IFS function to simplify the writing of a nested IF.

How to use the IFS function?

The IFS function in Excel checks multiple conditions and returns a value for the first TRUE condition.

=IFS(condition1, result1, condition2, result2, …)

  • Excel checks conditions in order and returns the first match.
  • If no condition is TRUE, Excel gives an error.
  • 💡 Tip: Add a final TRUE, “Default” to avoid errors 😉

In our example, we will write the following formula

Nested if with the IFS function

Replace Nested IFs with VLOOKUP for Range-Based Lookups

Writing multiple nested IF functions can quickly become complex and hard to manage when dealing with grading systems, commission rates, or tax brackets. Imagine setting up a formula to assign a grade based on a score:

=IF(A2>=90, “A”, IF(A2>=80, “B”, IF(A2>=70, “C”, IF(A2>=60, “D”, “F”))))

This approach works but becomes difficult to modify or expand. Instead, you can use VLOOKUP with the argument TRUE (or XLOOKUP), simplifying the process by searching for the closest match in a sorted table. This method works only for numerical values and efficiently handles range-based lookups.

👉 Return a Value Between Two Values in a Range.

VLOOKUP to return a value in a range of values

Practice with exercises

Track unpaid invoices with nested IF and IFS functions, directly in the grid below.

unpaid invoices quiz19

IF Function Exercise - Spot unpaid or underpaid invoices

Flag unpaid invoices and calculate the balance due using logical tests, a nested IF and the IFS function — 10 guided steps, write each formula then fill it down.

Write the formula in cell D2

1 / 10

In D2, write a logical test that checks whether the invoice is unpaid (the amount paid is empty).

Unpaid — Q1 · 190

2 / 10

Fill down the test (column D)

Unpaid — Q2 · 191

Write the formula in cell E2

3 / 10

In E2, write a logical test that checks whether the amount paid matches the amount of the invoice.

Unpaid — Q3 · 192

4 / 10

Fill down the test (column E)

Unpaid — Q4 · 193

Write the formula in cell F2

5 / 10

In F2, write an IF function that displays "KO" when the invoice has not been paid, and stays empty otherwise.

Unpaid — Q5 · 194

6 / 10

Fill down the IF (column F)

Unpaid — Q6 · 195

Write the formula in cell G2

7 / 10

In G2, write nested IFs: if the invoice has not been paid, display "KO"; otherwise, if the invoice amount differs from the amount paid, display the difference; otherwise display nothing.

Unpaid — Q7 · 196

8 / 10

Fill down the nested IFs (column G)

Unpaid — Q8 · 197

Write the formula in cell H2

9 / 10

In H2, write the same test with the IFS function (first whether the invoice is unpaid, then whether the invoice amount matches the amount paid).

Unpaid — Q9 · 198

10 / 10

Fill down IFS (column H)

Unpaid — Q10 · 199

Your score is

0%

Related articles

Practice this function

Reading is a good start, but practice is how you remember. These exercises are based on real questions from Excel forums, with instant correction.

Leave a Reply

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

Nested IF and IFS Functions in Excel

Reading time: 3 minutes

Nested IF allows you to create IF statement with more than 2 results. In Excel, you can build nested IF with many functions. In this article, we will present many cases.

How to Create Nested IF Formulas in Excel

The IF function returns a maximum of 2 results according to the result of a logic test: TRUE or FALSE. However, in many situations, the conditions could exceed 2 results.

For instance, we have a database of customers, and some of them have premium statuses. We want to apply a specific percentage discount according to the status

  • Gold (20%)
  • Silver (10%)
  • Bronze (5%)

With the IF function =IF(B2="Gold",20%,5%), we can only create a condition for one value, here ‘Gold’ 🫤 And, of course, the result is false when the value is ‘Silver’, ‘Bronze’, or empty. So, when you must analyse multi-criteria, you must write a nested IF formula in Excel.

With only one IF function we don't cover all situations

How to write a nested IF with the IF function?

Originally, in Excel, this was the only way to manage multiple statements. The secret is to replace the FALSE argument with another IF function to test another situation. For instance, we can write another test in our previous function like this

Nested IF with 3 criteria to evaluate
  • We have 2 IF functions, so we must close 2 parenthesis at the end of the function
  • But it’s still not what we want because we don’t manage the case when the cell Bx is empty.
  • We must write a 3rd IF function like this to cover all cases.
Nested IF with 4 criteria

The formula works, and the result is correct, but such a formula is not easy to write because it’s easy to make mistakes (like forgetting to close the proper number of parenthesis).

This is why, since Excel 2016, Microsoft has created the IFS function to simplify the writing of a nested IF.

How to use the IFS function?

The IFS function in Excel checks multiple conditions and returns a value for the first TRUE condition.

=IFS(condition1, result1, condition2, result2, …)

  • Excel checks conditions in order and returns the first match.
  • If no condition is TRUE, Excel gives an error.
  • 💡 Tip: Add a final TRUE, “Default” to avoid errors 😉

In our example, we will write the following formula

Nested if with the IFS function

Replace Nested IFs with VLOOKUP for Range-Based Lookups

Writing multiple nested IF functions can quickly become complex and hard to manage when dealing with grading systems, commission rates, or tax brackets. Imagine setting up a formula to assign a grade based on a score:

=IF(A2>=90, “A”, IF(A2>=80, “B”, IF(A2>=70, “C”, IF(A2>=60, “D”, “F”))))

This approach works but becomes difficult to modify or expand. Instead, you can use VLOOKUP with the argument TRUE (or XLOOKUP), simplifying the process by searching for the closest match in a sorted table. This method works only for numerical values and efficiently handles range-based lookups.

👉 Return a Value Between Two Values in a Range.

VLOOKUP to return a value in a range of values

Practice with exercises

Track unpaid invoices with nested IF and IFS functions, directly in the grid below.

unpaid invoices quiz19

IF Function Exercise - Spot unpaid or underpaid invoices

Flag unpaid invoices and calculate the balance due using logical tests, a nested IF and the IFS function — 10 guided steps, write each formula then fill it down.

Write the formula in cell D2

1 / 10

In D2, write a logical test that checks whether the invoice is unpaid (the amount paid is empty).

Unpaid — Q1 · 190

2 / 10

Fill down the test (column D)

Unpaid — Q2 · 191

Write the formula in cell E2

3 / 10

In E2, write a logical test that checks whether the amount paid matches the amount of the invoice.

Unpaid — Q3 · 192

4 / 10

Fill down the test (column E)

Unpaid — Q4 · 193

Write the formula in cell F2

5 / 10

In F2, write an IF function that displays "KO" when the invoice has not been paid, and stays empty otherwise.

Unpaid — Q5 · 194

6 / 10

Fill down the IF (column F)

Unpaid — Q6 · 195

Write the formula in cell G2

7 / 10

In G2, write nested IFs: if the invoice has not been paid, display "KO"; otherwise, if the invoice amount differs from the amount paid, display the difference; otherwise display nothing.

Unpaid — Q7 · 196

8 / 10

Fill down the nested IFs (column G)

Unpaid — Q8 · 197

Write the formula in cell H2

9 / 10

In H2, write the same test with the IFS function (first whether the invoice is unpaid, then whether the invoice amount matches the amount paid).

Unpaid — Q9 · 198

10 / 10

Fill down IFS (column H)

Unpaid — Q10 · 199

Your score is

0%

Related articles

Practice this function

Reading is a good start, but practice is how you remember. These exercises are based on real questions from Excel forums, with instant correction.

Leave a Reply

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