# IF Function Excel Tutorial: One Test, Two Results, Three or More Cases

How a TRUE/FALSE test picks one of two results, why nesting a second IF in the false slot creates a third outcome, and how the order of the tests quietly decides the answer.

> excel formulas · if function · About 6 min · Nov 3

## Key points

1. IF takes one question that evaluates to TRUE or FALSE and returns one of two results unchanged; text results need quotes, numbers and TRUE/FALSE do not.
2. A third outcome comes from putting a second IF in the false slot, not from adding a condition to the first test; the inner test only runs when the outer one failed, so it needs only a lower bound.
3. Because the first TRUE wins, tests must run from strictest threshold to loosest; reversing the order makes higher thresholds unreachable and silently returns the wrong bucket.
4. IFS replaces nested IF with test/value pairs, but returns #N/A when nothing is TRUE, so a final TRUE pair supplies the default; a test that is not TRUE/FALSE gives #VALUE!.
5. Blank cells compare as zero and any text outranks every number, so check ISNUMBER and test for blank before trusting a threshold formula.

---

A spreadsheet that only adds and multiplies can tell you what a number is. It cannot tell you what the number *means*. Whether a score is a pass, whether a stock level needs reordering — those are decisions, and in Excel a decision is a formula that returns a different answer depending on a test.

`IF` takes one question that can only be answered yes or no and hands back one of two results. By the end of this tutorial you will have built that formula, extended it to three and five outcomes with nested `IF` and with `IFS`, and — most importantly — you will know why the *order* of the tests decides the answer, which is where almost every broken grading formula goes wrong.

**What you need:** Excel 2019 or later, Microsoft 365, or Excel for the web. `IFS` exists in 2019 and later and in the web version; in Excel 2016 and older you use nested `IF` instead. You should already know that a formula starts with `=` and that `B2` points at a cell — if that is shaky, read [cells, formulas and cell references](https://eulore.ai/articles/how-to-use-excel-5a9f3a0a) first.

Type this table starting in `A1`:

| | A | B |
|---|---|---|
| **1** | Student | Score |
| **2** | Ada | 95 |
| **3** | Ben | 82 |
| **4** | Cara | 68 |
| **5** | Dev | 55 |

## Step 1: One test in, one of two answers out

Type `Result` in `C1`, then this in `C2`:

```
=IF(B2>=60,"Pass","Fail")
```

`C2` shows **Pass**. Change `B2` to `40` and it flips to **Fail**; set it back to `95`.

The formula has three pieces, separated by commas:

- **logical_test** — the question: `B2>=60`
- **value_if_true** — what to return when the question comes back TRUE: `"Pass"`
- **value_if_false** — what to return when it comes back FALSE: `"Fail"`

Excel reduces the test to a single TRUE or FALSE, then returns whichever of the other two arguments matches, unchanged. That is why text must sit inside quotes: type `Pass` bare and Excel reads a name it does not know and gives you `#NAME?` [1]. Numbers and `TRUE`/`FALSE` need no quotes. The test itself can use `=`, `<>`, `>`, `>=`, `<` or `<=`, and the result slots are not limited to text — `=IF(B2>=60,B2-60,0)` returns a number.

## Step 2: Copy it down and check the references

Drag the fill handle from `C2` to `C5`. You should see Pass, Pass, Pass, Fail for Ada, Ben, Cara and Dev.

The formula moved with the rows: `C5` reads `=IF(B5>=60,"Pass","Fail")`, because `B2` is a relative reference. If a whole column suddenly returns the same verdict, the usual cause is a `$` that locked the test to one row, so every row is grading Ada.

## Step 3: A third outcome is a second IF in the false slot

In `D2`, enter:

```
=IF(B2>=90,"A",IF(B2>=80,"B","C"))
```

Copy down: Ada 95 → **A**, Ben 82 → **B**, Cara 68 → **C**, Dev 55 → **C**.

The inner `IF` sits exactly where `"Fail"` sat before. Nothing else changed — it is still one test and two results, except one of the results is itself a whole `IF` formula. Excel evaluates the outer test and, *only if it fails*, goes on to the inner one.

That explains something that looks like a missing condition. The inner test says `B2>=80` and never says "and less than 90." It does not have to: a score only reaches that test after proving it is not 90 or above. Each rung asks only about what is left over.

## Step 4: Order the tests from strictest to loosest

Because the first TRUE wins and the rest are skipped, the order is part of the logic. Swap the two tests:

```
=IF(B2>=80,"B",IF(B2>=90,"A","C"))
```

Ada's 95 now comes back as **B**. The outer test is TRUE, so Excel returns `"B"` and never reaches `>=90`. The second test is not broken; it is simply unreachable for any score that already cleared 80.

```mermaid
flowchart LR
  S["Score 82"] --> T1{"82 >= 80 ?"}
  T1 -->|"TRUE"| R1["Return B — stop"]
  T1 -->|"FALSE"| T2{"82 >= 90 ?"}
  T2 -->|"TRUE"| R2["Return A"]
  T2 -->|"FALSE"| R3["Return C"]
```

The rule: write the tests highest threshold first, and let the final slot be the leftover case with no test at all. If you find yourself adding an upper bound (`>=80` *and* `<90`), you are nesting in the wrong order — the flow of TRUE/FALSE already enforces the upper bound. (Testing several conditions at once with `AND`/`OR` is a different tool, covered in a later article.)

## Step 5: IFS writes the same ladder as pairs

Five buckets as nested `IF` looks like this:

```
=IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2>=60,"D","F"))))
```

Four `IF`s, four closing parentheses, and the `"F"` buried at the deepest level. The same thing with `IFS`:

```
=IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C",B2>=60,"D",TRUE,"F")
```

`IFS` takes pairs — a test, then the value for that test — and returns the value belonging to the **first** test that comes back TRUE [2]. Same answers: Ada **A**, Ben **B**, Cara **D**, Dev **F**. Nothing is nested, so nothing needs matching parentheses, and a sixth band costs two more arguments.

Three `IFS` rules matter when the answer looks wrong:

- **No test passed?** `IFS` returns `#N/A`. Nested `IF` never does this, because its last slot catches everything. Fix it with a deliberate catch-all: make the final test `TRUE`, which always passes — that is where Dev's `"F"` comes from above.
- **A test with no value after it** (an odd number of arguments) gives "You've entered too few arguments for this function."
- **A test that does not resolve to TRUE/FALSE**, such as `=IFS(B2,"A")` where `B2` holds 95, gives `#VALUE!`. The test has to be a comparison.

`IFS` allows up to 127 pairs, and Microsoft explicitly advises against stacking that many, because the order has to be right and long ladders are hard to test and update [2].

## Step 6: Prove the ladder works before you trust it

A ladder that is off by one rung can run for months unnoticed, because the output still looks plausible. Feed it the values a boundary can hide in — `89`, `90`, `79`, `80`, `59`, `60`, `0` — copy the formula down against them, and check that each value changes bucket exactly at the threshold. Then add a blank cell and a cell containing text; both behave oddly, as the next section shows.

## When the answer looks wrong

| What you see | What happened | Fix |
|---|---|---|
| The word **FALSE** | The test failed and you gave only two arguments, so there is no false result | Add the third argument, or `""` |
| **0** | A result slot is empty but its comma is there, e.g. `=IF(B2>=60,,"Fail")` | Fill both slots |
| **#NAME?** | Text result typed without quotes, or the name misspelled | Wrap text in `"` |
| **#N/A** | `IFS` with no test TRUE and no catch-all | Add `TRUE,"default"` last |
| **#VALUE!** | A test that returns a number instead of TRUE/FALSE | Make it a comparison |
| The whole column lands in one bucket | Ladder ordered loose-to-strict, or a `$`-locked reference | Reorder; unlock |
| A blank row is graded | An empty cell compares as `0` in `>=` and `<` tests | Test the blank first: `=IF(B2="","",IF(B2>=60,"Pass","Fail"))` |

One trap produces no error at all: **Excel ranks any text above every number.** A score imported as text — `"45"` aligned left with a green warning triangle — passes a `>=100` test, because text beats any number in a comparison. The same text-versus-number confusion that stops duplicates from matching will quietly break an `IF`. Check with `=ISNUMBER(B2)` before you build a ladder on that column.

## What IF cannot do

`IF` asks a question about one row and puts one value in one cell. It cannot count how many rows pass or add up the ones that do — that is the `COUNTIF`/`SUMIF` family, applied to a whole column at once (the [COUNTIFS helper column in the duplicates article](https://eulore.ai/articles/how-to-remove-duplicates-in-excel-cc3c9be2) is a first taste). And when a ladder grows past four or five rungs, the formula stops being the right place to keep the logic; that is a lookup, and it comes next.

## Mind map

```mermaid
flowchart LR
  A["IF function"] --> B["Three arguments: test, value if TRUE, value if FALSE"]
  B --> C["Test reduces to TRUE or FALSE"]
  C --> D["Returns the matching argument unchanged"]
  B --> E["Third case: nest an IF in the false slot"]
  E --> F["First TRUE wins, so order strictest to loosest"]
  F --> G["Wrong order: higher rung unreachable, wrong bucket"]
  B --> H["IFS: test/value pairs in one line"]
  H --> I["No TRUE gives #N/A, so add TRUE as default"]
  F --> J["Check boundaries 89, 90, 79, 80 before trusting it"]
  D --> K["Silent traps: text outranks numbers, blanks read as 0"]
```

## Glossary

- logical_test：the first argument of IF, a comparison Excel reduces to a single TRUE or FALSE before choosing a result.
- Nested IF：an IF placed inside another IF's true or false slot, so the second test only runs if the first one did not settle the answer.
- First TRUE wins：Excel stops at the first test that passes and skips the rest, which makes the order of the tests part of the logic.
- IFS：a function that takes test/value pairs in one flat list and returns the value of the first test that passes, without nesting.
- Catch-all test：a final test written as TRUE, which always passes, so the formula has a deliberate default instead of #N/A.

## Sources

1. [Microsoft Support: IF function — syntax, argument rules, quotes around text results, common errors](https://support.microsoft.com/en-us/office/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2)
2. [Microsoft Support: IFS function — test/value pairs, first TRUE wins, 127 conditions, #N/A and #VALUE! behaviour](https://support.microsoft.com/en-us/office/ifs-function-36329a26-37b2-467c-972b-4a39bd951d45)

---

Original article: https://eulore.ai/articles/if-function-excel-b7ffd56e

> **Eulore** · Start small. Go deep.
>
> Eulore is an AI learning tool built around connected articles, each a 5–10 minute read. Ask questions as you go and help shape what comes next. That’s how this article was created.
>
> Start your own series → https://eulore.ai
