Google Sheets Nested IF: Syntax and Examples

How-to basics · Updated November 21, 2026

In Google Sheets, a nested IF formula places one IF function inside another so a cell can return different results for several conditions. For example, it can assign a letter grade based on a score; the key is to check conditions in the right order and include a final result for everything else.

What a nested IF does

An IF function evaluates a test and returns one value when the test is true and another when it is false. Nesting means using another IF as one of those return values. If the first test is false, Sheets checks the next test, then continues until a test is true or the formula reaches its final fallback.

This is useful when a result depends on a short series of ordered rules. Common examples include converting scores to grades, assigning a shipping category based on an order total, or labeling a response as high, medium, or low priority. A nested IF returns one result for each input; it does not automatically create a separate output for every condition.

For instance, a score of 86 should receive a B in a grading system where 90 or more is an A and 80 or more is a B. The formula tests the A condition first. Because 86 is below 90, it moves to the next IF, where it meets the B condition.

Nested IF syntax in Google Sheets

The basic structure is =IF(condition1, result_if_true1, IF(condition2, result_if_true2, result_if_false2)). The second IF is the value returned when the first condition is false. It can contain another IF, and that function can contain another one in turn.

Each IF has three parts: a logical test, a value to return if the test is true, and a value to return if it is false. The test may compare a cell with a number or text, or evaluate a function such as AND. Text results need double quotes; numbers and cell references do not. Parentheses mark where each function begins and ends, so every opening parenthesis needs a matching closing one.

With a score in A2, the formula below assigns four possible labels. The conditions are tested from highest threshold to lowest, and the final text handles scores below 70.

Cell layout: A2 contains the score. Enter this formula in B2. With 86 in A2, the result is B.

=IF(A2>=90,"A",IF(A2>=80,"B",IF(A2>=70,"C","Needs review")))

How to build one step by step

It is easier to construct a nested IF from the last decision backward. First decide what should happen when none of the tests match. Then add the final condition and result, and place that function in the false-result position of the next IF.

  1. Write down every possible outcome, including what to return when no condition is met.
  2. Put the most specific or highest-priority test first, and decide the order for the remaining tests.
  3. Start with an IF for the first test and add its true result.
  4. Use another IF as the first function’s false result, continuing until the final fallback is reached.
  5. Check the parentheses, enter the formula in the intended cell, and test values at each threshold as well as values between thresholds.

When you fill the formula down a column, relative references such as A2 normally adjust to A3, A4, and so on. If a test needs to refer to a fixed cell, such as a threshold stored in D1, make that reference absolute with dollar signs, as in $D$1. This prevents it from shifting when the formula is copied.

Examples for common decisions

A nested IF can handle more than numeric ranges. It can also return a blank for an empty input, or check several requirements together. In the next example, a person must be at least 18 and have answered Yes to a consent question. The blank check prevents an empty age cell from being labeled Not eligible.

Cell layout: A2 contains an age, and B2 contains Yes or No for consent. Enter the formula in C2. If A2 is 20 and B2 is Yes, the result is Eligible; if A2 is 16 and B2 is Yes, the result is Not eligible.

=IF(A2="","",IF(AND(A2>=18,B2="Yes"),"Eligible","Not eligible"))

AND requires all the conditions inside it to be true. OR is useful when any one of several options is sufficient. For example, a task might be urgent if its status is Overdue or its priority is Critical. Make the rule clear before writing the formula, because a correct formula can still give an unwanted answer if the condition does not express the intended policy.

For several score bands, Google Sheets’ IFS function can be easier to scan than a chain of nested IFs. It takes condition-and-result pairs and returns the result for the first true condition. The final TRUE acts as a catch-all, similar to the last false result in the nested IF example.

Cell layout: A2 contains a score. Enter this formula in B2. A score of 86 returns B, and a score below 70 returns Needs review.

=IFS(A2>=90,"A",A2>=80,"B",A2>=70,"C",TRUE,"Needs review")

Why condition order matters

Sheets checks the conditions in sequence and stops at the first true one. That makes order important when the conditions overlap. In the grade example, a score of 95 is also greater than 80 and 70, but it should be classified as A. Testing 90 or more first ensures it receives that result.

If the same tests are placed in ascending order, a score of 95 meets the first test of 70 or more and receives C; Sheets never reaches the later tests. For ranges, test from the most restrictive threshold down, or define non-overlapping ranges explicitly. For text categories, put exceptional or high-priority cases before broad rules that could also match them.

Before relying on a formula, test edge cases: the exact threshold, one value just below it, one just above it, an empty input, and an unexpected value. If a score of exactly 80 should receive B, the comparison must include equality, as in >=80. A greater-than test would exclude 80.

Choosing between nested IF, IFS, and lookup tables

Nested IF is a reasonable choice when there are only a few rules and the branching logic is easy to explain. It is widely recognizable in spreadsheets and lets each true or false branch return a different kind of value. Its drawback is readability: each additional branch adds another layer of parentheses and makes edits more error-prone.

IFS is often clearer when every condition simply maps to a result, as in a list of grade thresholds. It does not use a nested false-result chain, but conditions still run in order, so overlapping tests must be arranged carefully. Include a final catch-all such as TRUE if every input needs a defined result; without a matching condition, IFS can return an error.

If rules change frequently or there are many categories, consider putting thresholds and labels in a small reference table instead of embedding them in a long formula. A table makes the rules visible and easier to update in one place. The best lookup method depends on the table’s layout and whether its thresholds are exact matches or ranges. For a small, fixed decision tree, an IF or IFS formula may be simpler than maintaining a separate table.

Common errors and ways to fix them

  • Wrong result for a high value: Check whether a broad, lower threshold comes before a narrower, higher one. Reorder the conditions so the intended result is selected first.
  • Formula parse error: Look for missing commas, quotation marks, or parentheses. In some spreadsheet locales, formulas use semicolons instead of commas as argument separators. The locale setting can affect the separator Sheets expects.
  • Text does not match: Confirm that the text in the cell matches the formula’s test, including spaces and spelling. A value that looks like a number may actually be stored as text, which can affect comparisons.
  • Unexpected result for a blank cell: Add an explicit blank check near the start if blanks should remain blank. Otherwise, a blank may be evaluated as a value in later tests.
  • IFS returns an error: Add a final catch-all condition and result if inputs may fall outside the listed cases.

When a formula becomes difficult to read, put each IF on a separate line while editing if that helps you track the branches, then verify that the final formula is still valid. You can also temporarily test a smaller piece of the logic in an unused cell. Avoid changing several conditions at once; checking one branch at a time makes it easier to find the source of a wrong result.

Google Sheets and Excel differences

Google Sheets in a web browser supports IF and IFS, and the basic logic shown here is also familiar to Excel users. The formulas in this article use comma separators and English function names. Depending on regional settings, Sheets may expect semicolons instead; the spreadsheet’s locale can also affect how numbers and dates are interpreted.

Excel also supports nested IF and IFS, but its interface and some features differ from Google Sheets. When sharing a workbook or copying formulas between the programs, check whether both use compatible separators, function names, and date conventions. For a basic nested IF, the central idea remains the same: evaluate conditions in order and provide a result for each relevant path.

Frequently Asked Questions

How many IF functions can I nest in Google Sheets?
Google Sheets allows nested functions, but a long chain becomes difficult to read and maintain. For many conditions, consider IFS or a reference table rather than adding more branches just because it is possible.

Can a nested IF return text?
Yes. Put text results in double quotes, such as “Approved” or “Review required”. Cell references and numeric results do not need quotation marks.

What happens if no condition is true?
The formula returns the final false-result value in a nested IF. In IFS, include a final catch-all condition such as TRUE if you want a defined result for inputs that do not match earlier tests.

Can I use AND or OR inside a nested IF?
Yes. AND combines tests that must all be true, while OR combines tests where at least one must be true. They can be used as the condition for an IF, provided the combined rule reflects the decision you intend.

Why does my formula show a parse error?
Check balanced parentheses, commas, and quotation marks first. If those look correct, check whether your Sheets locale requires semicolons between arguments instead of commas.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.