formulastreak

Logic and errors function

IFS function in Google Sheets and Excel

IFS tests conditions in order and returns the result of the first one that's TRUE: a flat alternative to nested IFs.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2], ...)

Arguments in [brackets] are optional. Google Sheets writes it IFS(condition1, value1, [condition2, value2], …).

Example

=IFS(G2>=40000,"Gold",G2>=35000,"Silver",TRUE,"Bronze") reads: If G2 (the quarter total) is at least 40,000, show Gold; otherwise, if it's at least 35,000, show Silver; otherwise (TRUE) show Bronze.

Q3 sales team · edit H2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultH2 = Silver
ABCDEFGH
1RepRegionJulAugSepTargetQ3 totalMedal
2Amara OseiNorth$12,400$13,100$11,800$36,000$37,300Silver
3Ben FischerSouth$9,800$10,250$12,100$30,000$32,150Bronze
4Lina ChenEast$15,200$14,800$16,900$45,000$46,900Gold
5Diego AlvarezWest$8,700$9,100$8,400$28,000$26,200Bronze
6Eva NovakNorth$11,200$12,600$13,900$36,000$37,700Silver
7Farid HaddadSouth$13,300$12,900$14,100$39,000$40,300Gold
8Grace KimEast$10,100$9,600$10,800$33,000$30,500Bronze
9Hugo MartinWest$14,500$15,800$15,100$42,000$45,400Gold

H2 shows Silver for Amara, the same medal as the nested IF. Lina in H4 gets Gold, and the final TRUE,"Bronze" catches everyone below $35,000.

How the spreadsheet calculates it

Goes through the conditions in order and returns the result of the first one that's TRUE: if G2 is greater than or equal to 40000, "Gold"; if G2 is greater than or equal to 35000, "Silver"; otherwise "Bronze".

  1. 1. IFS: Goes through the conditions in order and returns the result of the first one that's TRUE: if G2 is greater than or equal to 40000, "Gold"; if G2 is greater than or equal to 35000, "Silver"; otherwise "Bronze".
    • test1 = `G2>=40000`: the first comparison (highest bar first)
    • result1 = `"Gold"`: what to show when test1 is TRUE
    • test2 = `G2>=35000`: the next comparison, tried only if test1 was FALSE
    • result2 = `"Silver"`: its result. End with `TRUE, fallback`
    • condition3 = `TRUE`: a comparison that's TRUE or FALSE
    • value3 = `"Bronze"`: a value, a cell or a calculation

More IFS examples

  • =IFS(D2>=90,"A",D2>=80,"B",D2>=70,"C",TRUE,"F")A letter grade from a score, highest band first.
  • =IFS(H2="Shipped","Done",H2="Pending","Chase",TRUE,"Check")A next step for each order status.
  • =IFS(C2=0,"No budget",D2>C2,"Over",TRUE,"OK")A budget status that tests the zero budget first.
  • =IFS(E2>D2,"Up",E2<D2,"Down",TRUE,"Flat")September compared with August for each rep.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Write the tests from the strictest to the loosest.
  • Always end with TRUE, fallback so no row shows #N/A.
  • Keep the boundaries in cells when they might change, and refer to them with $.

What IFS is used for

Grades and medals from scores, commission tiers, status labels from several fields (Over budget, On track, No budget), and shipping or discount bands, wherever a nested IF would go three or more levels deep.

Arguments

ArgumentRequiredWhat it is
logical_test1YesThe first condition, such as G2>=40000. Put the strictest test first.Watch out: A looser test first (G2>=35000 before G2>=40000) catches everyone, so the later test is never reached.
value_if_true1YesWhat to return when logical_test1 is TRUE: text in quotes, a number or a calculation.
logical_test2, value_if_true2, ...NoMore pairs, tried in order. Microsoft allows up to 127 conditions. End with TRUE and a fallback value to catch everything else.

Common mistakes

  • Leaving out the final TRUE, fallback: anyone who passes no test gets #N/A.

  • Giving a condition without its value: Microsoft documents that Excel refuses the formula with a "too few arguments" message.

  • Using IFS to match one cell against exact values ("N" → North, "S" → South…): SWITCH names the cell once and is shorter.

In Google Sheets

Google Sheets has IFS with the same pairs (condition1, value1, …). Neither app has a separate "else" argument: end with TRUE and the fallback value in both.

Errors you may see with IFS

  • #N/A: No test is TRUE and there's no final `TRUE, fallback` pair. Microsoft documents #N/A for this.
  • #VALUE!: A logical_test returns something other than TRUE or FALSE, such as text.
  • #NAME?: The file is open in Excel 2016 or older, which doesn't have IFS.

Questions

IFS or nested IF: which should I use?

IFS reads top to bottom with one closing bracket, so it's easier to check. Nested IF works in every version. See nested IF vs IFS.

How do I add an "else" to IFS?

Make TRUE the last condition: …,TRUE,"Bronze"). TRUE is always TRUE, so it catches every row the earlier tests missed.

When is a lookup table better than IFS?

When the bands change or there are many of them. Keep the boundaries in cells and use XLOOKUP with match mode -1: changing a boundary then needs no formula edits.

Why does IFS give the wrong band?

The tests are in the wrong order. IFS stops at the first TRUE, so with "at least" tests start from the highest boundary and work down.

Sources

Official documentation the facts on this page were checked against.

Practise IFS on a live sheet

Lesson 13, IFS and SWITCH (Unit 3, Decisions), has 3 graded exercises, checked instantly, with steps and hints when you're stuck. Pro