To create nested IFs in Google Sheets, put another IF inside the first one’s result: for example, with a score in A2, =IF(A2>=90,"A",IF(A2>=80,"B","Below B")) returns A for 90 or higher, B for 80–89, and Below B otherwise. Each IF checks a condition and supplies an outcome for true and false, letting one formula handle several cases.
What a nested IF does
A basic IF formula chooses between two outcomes. A nested IF extends that choice: the outcome for one condition can itself be another IF, which checks a second condition. The formula keeps evaluating until it reaches an outcome that does not contain another IF. This is useful when a value belongs to one of several categories, such as a grade band, shipping tier, service level, or commission bracket.
The order of the checks matters. In a set of score thresholds, test the highest threshold first and work downward. If the formula checks whether a score is at least 60 before checking whether it is at least 90, a score of 95 will already meet the first condition and receive the wrong result. Each later test only runs if the earlier test was false.
Nested IFs do not search a table automatically or interpret category names. They evaluate the conditions in the order written and return the corresponding result. That makes the formula powerful, but it also means that a long formula can be difficult to read or update.
How the IF syntax works
In Google Sheets, IF has three parts: a condition, the value to return if the condition is true, and the value to return if it is false. For instance, a condition might compare a cell with a number or check whether it matches text. The true and false outcomes can be text, numbers, cell references, or another formula.
In a nested formula, the next IF goes in the true or false outcome position where another decision is needed. Text results need straight double quotation marks; cell references and numeric results do not. Parentheses must be balanced so that each IF’s arguments are grouped correctly. Google Sheets highlights parts of a formula as you edit, which can help identify a missing closing parenthesis.
The examples below use commas between arguments, as is common in Google Sheets. Depending on the spreadsheet’s locale, the formula separator may instead be a semicolon. If a formula with commas produces a parse error, check the spreadsheet’s locale under File > Settings and use the separator expected by that locale.
Example: assign letter grades
Suppose A2 contains a student’s score from 0 to 100. The formula below checks grade cutoffs from highest to lowest. At 84, it returns B; at 72, it returns C; at 58, it returns F. These results assume the score is a number and that the cutoffs are the intended grading policy.
With the score in A2, enter this in another cell: =IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C",IF(A2>=60,"D","F")))). A2 equal to 84 returns B. The final “F” is the fallback result: it applies if none of the earlier conditions is true.
To use the formula on multiple rows, place it beside the first score and copy it down using the fill handle at the corner of the selected cell. The relative reference A2 adjusts to A3, A4, and so on. If the cutoff values should be editable, keeping them in cells rather than embedding every number in the formula can make later changes easier to manage.
Build a nested IF without losing track
Writing a long formula all at once makes it easy to reverse a condition or omit a parenthesis. A more reliable method is to start with the simplest two-outcome decision, then add one test at a time.
- Write down each condition and its result in the order it should be evaluated.
- Decide what should happen when none of the conditions match. This is the final fallback.
- Build the formula with the first condition and fallback, then replace the appropriate outcome with the next IF.
- Test values at every boundary, such as 59, 60, 69, 70, 79, 80, 89, and 90 for the grade example.
- Test a typical value and any unusual inputs, including blanks or text, if those might occur in the source column.
Boundary testing matters because a formula using >= behaves differently at the cutoff from one using >. For example, with a 60-point passing threshold, >=60 includes exactly 60, while >60 does not. Choose the comparison operator to match the rule, rather than changing it just to make a formula appear to work.
A practical example with two conditions
Nested decisions can combine different types of checks. Imagine that B2 holds an order total and C2 contains the word Member when the customer is a member. Members receive free shipping at 50 or more; other customers receive free shipping at 75 or more. With the order total in B2 and membership status in C2, enter =IF(C2="Member",IF(B2>=50,"Free","Discounted"),IF(B2>=75,"Free","Standard")). For a member with a total of 60, it returns Free. For a nonmember with that same total, it returns Standard.
This example checks membership first, then applies the relevant total threshold. The wording of the outcomes is just illustrative: a real sheet should use labels that match the business’s actual rules. Check what should happen when C2 contains a different spelling, an extra space, or a blank, since an exact text comparison will not treat every variation as Member.
When IFS, SWITCH, AND, or OR may fit better
A nested IF is not the only way to express several decisions. Google Sheets includes other functions that can make certain logic easier to read. The best choice depends on whether the formula is checking ordered thresholds, matching exact labels, or combining conditions.
- IFS: Helpful for a sequence of condition-and-result pairs. With a score in A2,
=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",A2>=60,"D",TRUE,"F")returns B when A2 is 84. The TRUE condition at the end supplies a fallback; without a condition matching, IFS can return an error. - SWITCH: Useful when one expression should be compared against several exact values, such as a short status code. It is not a direct substitute for a series of ranges such as scores above or below thresholds.
- AND and OR: Useful inside IF when a decision depends on multiple conditions being true, or on at least one condition being true. For example, with a score in B2 and completion status in C2,
=IF(AND(B2>=80,C2="Complete"),"Pass","Review")returns Pass only when both requirements are met. If B2 is 85 and C2 is Complete, the result is Pass.
For a large, frequently changing set of categories, a lookup table may be easier to maintain than a very long formula. Put the thresholds and corresponding outcomes in a clearly labeled table, then use an appropriate lookup approach. A table makes the rules visible to other editors and can reduce the risk of overlooking a threshold buried inside nested parentheses.
Common errors and how to fix them
A parse error usually means Google Sheets cannot interpret the formula’s structure. Check for missing parentheses, commas or semicolons that do not match the spreadsheet’s locale, and quotation marks around text. Curly quotation marks copied from a document can also cause trouble; formulas should use ordinary straight quotes.
A formula that returns a plausible but incorrect label often has a logic problem rather than a syntax problem. Review the condition order, check whether the comparison operators include the boundary, and confirm the fallback. Test the exact threshold values, not just scores well above or below them. If a value stored as text is being compared with a number, inspect the source data and convert it to the intended type.
Blanks deserve an explicit decision. Depending on the comparison, a blank may behave in a way that produces an unintended category. If A2 should stay blank when it has no score, with a score in A2 use =IF(A2="","",IF(A2>=60,"Pass","Fail")). When A2 is empty, this returns an empty displayed result; when A2 contains 75, it returns Pass. This does not validate every possible input, so add checks if text or out-of-range values need special treatment.
Another common mistake is assuming that every nested IF outcome has to be different. Outcomes can repeat, but doing so may make the formula harder to understand. If two conditions lead to the same result, consider whether they can be combined with OR, or whether a lookup table would make the rule clearer.
Readability and maintenance
Keep formulas understandable for the next person who has to check them. Use descriptive column headers, explain unusual business rules in a nearby note, and avoid changing a threshold in only one copy of a formula. If the same decision is used across many rows, copy the same formula consistently or store the decision rules in cells that can be reviewed centrally.
Google Sheets formulas are entered directly in a cell or the formula bar in the web browser. Start by selecting a cell, type the equals sign and formula, then press Enter. Google Sheets recalculates the result when a referenced value changes. The formula syntax for IF is broadly familiar to Excel users, but this article’s interface instructions are for Google Sheets; Excel has its own menus and version-specific function support. Both programs can use locale-dependent argument separators.
Consider replacing a nested formula when adding another condition makes it hard to audit, when nontechnical collaborators need to edit rules, or when categories change often. A compact formula is not automatically better if its logic is opaque. The useful test is whether someone can verify the rules and predict the result for important inputs.
Frequently Asked Questions
Can Google Sheets use more than two IF statements?
Yes. A formula can nest additional IF functions to handle more than two outcomes. Keep the conditions in a deliberate order, include a final fallback, and test the boundaries so the added branches do not hide an earlier mistake.
What happens if no nested IF condition is true?
Google Sheets returns the last outcome in the formula. That is why the final false outcome should be chosen intentionally, such as a default label or an empty string, rather than left as an accidental category.
Is IFS better than nested IF?
IFS can be easier to scan when there are several condition-and-result pairs. A nested IF may be preferable when one decision belongs specifically inside another, or when the logic is easier to explain as branches. Either way, specify a sensible fallback.
Why does my formula show a parse error?
Check the parentheses, text quotation marks, and argument separators. Many sheets accept commas, but locale settings can require semicolons. Also replace smart quotes with straight double quotation marks.
Can nested IF formulas check text as well as numbers?
Yes. Conditions can compare text, numbers, or other expressions. Text matching is exact unless the formula is written to account for variations, so consistent spelling and spacing in the source cells matter.
Related
- How to Insert a Table of Contents in Microsoft Word
- Inserting Citations in Word: A Step-by-Step Guide
- Inserting a Line in Word: Rules, Borders, and Shapes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Double Space in WordTo double-space text in Microsoft Word, select the text, then choose Home > Line and Paragraph Spacing >…
- Excel Find and Replace Within Selected Cells: Steps & TipsTo find and replace text only in selected Excel cells, select the range first, press Ctrl+H, enter the…
- How to Sort A to Z in Google Sheets Without ErrorsTo sort a list A to Z in Google Sheets, select the full range of related cells, open…
- Excel Dropdown List Dynamic Range: Setup and FixesTo make an Excel dropdown list use a dynamic range, store its choices in an Excel Table and…
- How to Add a Watermark to Every Page in Microsoft WordIn Word for Microsoft 365 on Windows, select Design > Watermark and choose a built-in option to place…
- Excel Important Shortcut Keys: A Practical Windows GuideThe most important Excel shortcut keys help you edit, navigate, format, and calculate without repeatedly reaching for the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.