0Pricing
Excel Formulas Academy · Lesson

Cleaner Branching With IFS

Replace stacked IF statements with the readable IFS function.

Cleaner Branching With IFS is a free Excel Formulas Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Problem With Stacked IFs

A single IF handles a yes-or-no choice. But what if you have many outcomes, like turning a score into a letter grade A through F? You would have to nest one IF inside another, again and again.

That nesting gets hard to read, easy to break, and tricky to count the closing parentheses. The IFS function was built to fix exactly this. It lets you list condition-and-result pairs in a clean, flat line.

What Nested IFs Look Like

Here is a grade formula written with nested IF functions. Each IF has another IF as its false branch.

It works, but notice how the parentheses pile up at the end and the logic is hard to scan. Imagine maintaining this with eight branches instead of four.

=IF(A2>=90, "A", IF(A2>=80, "B", IF(A2>=70, "C", "F")))

The Shape of IFS

The IFS function takes pairs of arguments: a condition, then the value to return if that condition is true. It checks them in order, top to bottom.

  • test1, value1 if test1 is true, return value1
  • test2, value2 otherwise, if test2 is true, return value2

It returns the value for the first condition that is true, then stops. You can chain up to 127 pairs.

=IFS(test1, value1, test2, value2, ...)

Rewriting the Grade Formula

Here is the same grading logic, now written with IFS. Each line is a clean condition-result pair, and there is no parenthesis pile-up.

IFS checks 90 first, then 80, then 70. The first true condition wins. Compare this to the nested version, it does the same job but reads far more clearly.

=IFS(A2>=90, "A", A2>=80, "B", A2>=70, "C", A2>=60, "D")

Order Matters

Because IFS returns the result of the first true condition, the sequence of your tests is critical. For ranges, go from the most restrictive to the least.

If you flipped the grade order and tested A2>=60 first, a score of 95 would wrongly return D, because 95 is also greater than 60 and that pair comes first. Always order your bands carefully from high to low or low to high consistently.

=IFS(A2>=90, "A", A2>=80, "B")

Adding a Catch-All

If none of the conditions are true, IFS returns an #N/A error. To avoid that, add a final catch-all pair whose condition is simply TRUE.

Since TRUE is always true, it acts like the final else branch of an IF. In the formula below, any score under 60 falls through to the last pair and returns F.

=IFS(A2>=90, "A", A2>=80, "B", A2>=70, "C", TRUE, "F")

A Worked Example: Shipping Tiers

Suppose order weight in A2 sets the shipping label. Under 1 kg is Small, under 5 kg is Medium, under 20 kg is Large, and anything heavier is Freight.

The IFS formula below lists each tier in order and uses a TRUE catch-all for the heaviest case. Each weight is checked against the bands until one matches.

=IFS(A2<1, "Small", A2<5, "Medium", A2<20, "Large", TRUE, "Freight")

Mixing in AND and OR

Each condition in IFS can be any logical test, including an AND or OR. This lets you build rich, multi-factor branches.

The example below assigns a customer tier: Gold if they spend over 1000 and are a member, Silver if they spend over 500 or are a member, otherwise Standard.

=IFS(AND(A2>1000, B2="Yes"), "Gold", OR(A2>500, B2="Yes"), "Silver", TRUE, "Standard")

Watch Out for Odd Arguments

IFS expects arguments in pairs: every condition must be followed by its value. A common error is forgetting a result or adding a stray comma, which leaves an unpaired argument.

  • Wrong: =IFS(A2>=90, "A", A2>=80) the last condition has no value
  • Right: =IFS(A2>=90, "A", A2>=80, "B")

If you get an error, count your arguments, they should always be an even number.

=IFS(A2>=90, "A", A2>=80, "B")

IFS vs SWITCH

IFS is perfect when each branch is a comparison, like ranges or different tests. If instead you are matching one value against a fixed list of exact options, the SWITCH function is often tidier.

Rule of thumb: use IFS for ranges and varied conditions; reach for SWITCH when you compare the same cell to several exact values. You will meet SWITCH later in the course.

Why IFS Matters

The IFS function replaces deeply nested IF statements with a flat, readable list of condition-result pairs. It is the go-to tool whenever a value can fall into one of several categories.

Keep these habits:

  • Order conditions carefully, since the first true one wins
  • Add a TRUE catch-all to avoid #N/A
  • Keep arguments paired and even in count

Now try a quick check.

Quick Check

Test your understanding of how the IFS function behaves.

Recap: Cleaner Branching With IFS

You learned that IFS handles many outcomes with a flat list of condition-and-result pairs, replacing hard-to-read nested IF formulas.

  • Syntax: =IFS(test1, value1, test2, value2, ...)
  • It returns the first true condition, so order matters
  • End with TRUE, "default" to catch everything else
  • Conditions can include AND and OR

You have now mastered combining conditions with AND, OR, NOT, and IFS. Great work!

=IFS(A2>=90, "A", A2>=80, "B", A2>=70, "C", TRUE, "F")

Frequently asked questions

Is the “Cleaner Branching With IFS” lesson free?

Yes — the full text of “Cleaner Branching With IFS” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Cleaner Branching With IFS”?

Replace stacked IF statements with the readable IFS function. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Cleaner Branching With IFS” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Requiring Everything With AND
  2. Accepting Any Match With OR
  3. Flipping Logic With NOT
  4. Cleaner Branching With IFS
← Back to Excel Formulas Academy