An IF statement in Excel lets you make a cell show one answer when a condition is true and a different answer when it is false. The formula is =IF(condition, value_if_true, value_if_false). For example, =IF(A2>=60,"Pass","Fail") displays “Pass” when the score in A2 is 60 or higher, and “Fail” otherwise. No add-ins or setup are required; IF is a built-in function in every desktop version of Excel, in Excel for the web, and in the mobile apps.

What You'll Need

  • Excel on Windows, Mac, the web, or mobile (Excel for the web and mobile can enter IF formulas, though typing long nested formulas is easier on a computer).
  • Data in cells you can reference, such as numbers, dates, or text.
  • A basic understanding that formulas start with an equals sign and that text values must be wrapped in double quotes.

Step-by-Step

  1. Pick the cell for the result. Click an empty cell beside your data, for example B2 if your data starts in A2. This is where the IF result will appear.
  2. Start the formula. Type =IF(. Excel will show a tooltip listing the arguments: logical_test, value_if_true, value_if_false. Argument names and separators can differ slightly depending on version and region (some regions use semicolons instead of commas), so read the tooltip as you type.
  3. Write the logical test. This is the question the formula asks. It must produce TRUE or FALSE. For example, A2>100, B2="Yes", or C2<>"" (not empty). Use =, <>, >, <, >=, <= for the comparison.
  4. Add the value if true. Type a comma (or semicolon), then what should appear when the test is true. Text goes in double quotes: "Over budget". Numbers usually go in bare: 100. You can also reference another cell, like D2.
  5. Add the value if false. Type a comma, then the result for a false test, such as "Within budget" or 0. Always supply this third argument unless you want a FALSE result in the cell.
  6. Close the formula and press Enter. Type ) and press Enter. Excel checks the syntax and displays the result. If it shows a green triangle or refuses the formula, the third argument or a quote mark is usually missing.
  7. Check with different data. Change the input cell and confirm the result flips. Enter a value that is exactly on the boundary (like 60 for the Pass example) to confirm your operator matches what you intend.
  8. Fill the formula down. Drag the small square at the bottom-right corner of the cell (the fill handle) down the column, or copy the cell and paste it into the rows below. Relative references adjust automatically, so A2 becomes A3, A4 and so on. Use $ signs (like $A$2) when a reference must stay fixed.
  9. Nest a second IF for more than two outcomes. Put a whole IF inside the value_if_false position: =IF(A2>=90,"A",IF(A2>=80,"B","C")). Excel evaluates the first test, then only tests the second when the first is false. Keep the order logical, from highest to lowest score in this example, because evaluation stops at the first true test.
  10. Combine conditions with AND or OR. Wrap them as =IF(AND(A2>=60,B2="Paid"),"Approved","Review"). AND needs every condition to be true; OR needs only one. There is a limit on how many functions can be nested, so switch to IFS or a lookup table when a formula grows past a few levels.

Common Mistakes

Forgetting quotes around text. =IF(A2=Yes,"OK","No") fails because Excel treats Yes as a name. Write "Yes". Numbers, by contrast, should not have quotes; "60" is text and will not compare correctly against a numeric 60.

Wrong comparison operator. Using > when you mean >= is the most common off-by-one error, especially with pass marks, due dates and thresholds. Test the exact boundary value.

Unbalanced parentheses or quotes. Each IF needs one closing parenthesis. Excel colours parentheses as you type so you can match them visually. A stray curly quote from a document or website also breaks the formula; retype straight quotes.

Mixing text and numbers. Cells that look like numbers but are stored as text (often imported data) will not compare as expected. Check alignment: numbers usually sit right-aligned, text left-aligned. Convert with the Text to Columns feature or by multiplying by 1.

Leaving value_if_false blank. =IF(A2>10,"High") returns FALSE for low values, not an empty cell. Add "" as the third argument if you want blank output.

Hard-coding results that should be references. Typing a tax rate or threshold into every formula makes updates painful. Put the value in a named cell and reference it.

Tips

Use named ranges for thresholds so formulas read clearly and are easy to update. Use IFERROR around formulas that might divide by zero or look up missing data, for example =IFERROR(A2/B2,""). Use COUNTIF or SUMIF when you need to count or total rows that meet a condition rather than label each row. To count how many rows pass, use =COUNTIF(A2:A100,">=60"). When the logic becomes a long chain, consider IFS (available in current Excel versions) or a small lookup table with VLOOKUP or XLOOKUP; both are easier to audit than deeply nested IFs. Format the output cell appropriately, since TRUE/FALSE values and numbers can look odd with the wrong number format. Keep a copy of important workbooks before large formula edits so you can revert.

Troubleshooting

The formula appears as text. The cell is probably formatted as Text, or the entry starts with an apostrophe. Format the cell as General, then re-enter the formula. In newer Excel versions there is also a Show Formulas toggle on the Formulas tab that displays formulas instead of results; turn it off if you see formulas in every cell.

#NAME? error. Usually a misspelled function name or unquoted text. Check the spelling of IF, AND and OR and make sure text has quotes.

#VALUE! error. You are comparing incompatible types, or a reference points at text where a number is expected. Inspect the source cell.

#N/A or unexpected blanks. A referenced cell is empty or contains an error itself. Trace which reference is returning the problem by testing each condition in its own cell.

Wrong result after filling down. Check whether an absolute reference was needed. If the formula shifts on copy, lock the reference with $ signs.

Formula won't accept commas. Your regional settings may expect semicolons as the argument separator. Follow whatever the tooltip shows.

If that did not work, rebuild the formula in small pieces: put the logical test alone in one cell, the true value in another, and the false value in a third, then combine them. This isolates the part that is broken.

Frequently Asked Questions

How many IF functions can I nest?

Current Excel versions allow up to 64 nested functions, but formulas become unreadable long before that. Use IFS or a lookup table for complex logic.

Is IF case-sensitive?

No. Excel's IF comparisons on text are not case-sensitive, so "yes" and "YES" match the same test. Use EXACT inside the test if case matters.

Can an IF statement return a blank cell?

Yes. Use "" as the true or false result, for example =IF(A2="","",A2*2).

Why does my formula return TRUE or FALSE instead of my text?

The missing or omitted argument, or a text value without quotes, is being treated as a logical value. Check all three arguments are present and text is in double quotes.

Do IF statements work in Google Sheets?

Yes, the same =IF(test, value_if_true, value_if_false) syntax works in Google Sheets, though some regional settings change the separator.

Can I use IF to check a date?

Yes, for example =IF(A2>TODAY(),"Upcoming","Past"). Make sure A2 is stored as a real date, not text.