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

Type this table starting in A1:

AB
1StudentScore
2Ada95
3Ben82
4Cara68
5Dev55

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

Type Result in C1, then this in C2:

1=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:

1=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:

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

Rendering

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:

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

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

1=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 seeWhat happenedFix
The word FALSEThe test failed and you gave only two arguments, so there is no false resultAdd the third argument, or ""
0A 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 misspelledWrap text in "
#N/AIFS with no test TRUE and no catch-allAdd TRUE,"default" last
#VALUE!A test that returns a number instead of TRUE/FALSEMake it a comparison
The whole column lands in one bucketLadder ordered loose-to-strict, or a $-locked referenceReorder; unlock
A blank row is gradedAn empty cell compares as 0 in >= and < testsTest 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 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.