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
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
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.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Rep | Region | Jul | Aug | Sep | Target | Q3 total | Medal |
| 2 | Amara Osei | North | $12,400 | $13,100 | $11,800 | $36,000 | $37,300 | Silver |
| 3 | Ben Fischer | South | $9,800 | $10,250 | $12,100 | $30,000 | $32,150 | Bronze |
| 4 | Lina Chen | East | $15,200 | $14,800 | $16,900 | $45,000 | $46,900 | Gold |
| 5 | Diego Alvarez | West | $8,700 | $9,100 | $8,400 | $28,000 | $26,200 | Bronze |
| 6 | Eva Novak | North | $11,200 | $12,600 | $13,900 | $36,000 | $37,700 | Silver |
| 7 | Farid Haddad | South | $13,300 | $12,900 | $14,100 | $39,000 | $40,300 | Gold |
| 8 | Grace Kim | East | $10,100 | $9,600 | $10,800 | $33,000 | $30,500 | Bronze |
| 9 | Hugo Martin | West | $14,500 | $15,800 | $15,100 | $42,000 | $45,400 | Gold |
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. IFS: Goes through the conditions in order and returns the result of the first one that's TRUE: if
G2is greater than or equal to40000,"Gold"; ifG2is greater than or equal to35000,"Silver"; otherwise"Bronze".test1=`G2>=40000`: the first comparison (highest bar first)result1=`"Gold"`: what to show when test1 is TRUEtest2=`G2>=35000`: the next comparison, tried only if test1 was FALSEresult2=`"Silver"`: its result. End with `TRUE, fallback`condition3=`TRUE`: a comparison that's TRUE or FALSEvalue3=`"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, fallbackso 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
| Argument | Required | What it is |
|---|---|---|
| logical_test1 | Yes | The 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_true1 | Yes | What to return when logical_test1 is TRUE: text in quotes, a number or a calculation. |
| logical_test2, value_if_true2, ... | No | More 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…):
SWITCHnames 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
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.